generic sliding panel - Free Download Generic Sliding Panel In jQuery - SlidePanel.js

Free Download Generic Sliding Panel In jQuery – SlidePanel.js

Posted on

This time I will share jQuery Plugin and tutorial about Generic Sliding Panel In jQuery – SlidePanel.js, hope it will help you in programming stack.

generic sliding panel - Free Download Generic Sliding Panel In jQuery - SlidePanel.js
File Size: 15.8 KB
Views Total: 646
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A lightweight yet versatile jQuery plugin used to create customizable sliding panels for site navigation on mobile, settings panes on dashboard, notification bars, feedback forms, social sharing widgets, and much more.

Features:

  • Slides out from top, bottom, left, or right of the page.
  • Configurable animations.
  • Auto closes the sliding panel when clicking a link inside it.
  • Push the body content to the other side similar to off-canvas push menu.
  • Prevents page scroll when the sliding panel is activated.
  • Useful callback functions.

How to use it:

1. Place the minified version of the SlidePanel.js plugin after loading jQuery.

1 <script src="/path/to/cdn/jquery.min.js"></script>
2 <script src="/path/to/src/SlidePanel.min.js"></script>

2. Add your content (like menu items) to the sliding panel.

1 <section id="example" class="myPanel">
2   ... Any Content Here ...
3 </section>

3. Initialize the plugin on the top container.

1 var instance = $('.myPanel').SlidePanel({
2     // options here
3 });

4. Activate the sliding panel.

1 instance.activate();

5. Apply CSS styles to the sliding panel.

01 .myPanel {
02   width: 400px;
03   background-color: #fff;
04   overflow: hidden !important;
05   z-index: 150000;
06   box-shadow: 8px 0 8px -10px #000000,-8px 0 8px -10px #000000;
07   position: fixed;
08   top: 0;
09   left: 0;
10   bottom: 0;
11   z-index: 1999999999;
12   text-align: left;
13   background: #fff;
14   pointer-events: auto;
15   max-height: 100vh;
16   display: flex;
17   flex-direction: column;
18   padding-top: 1rem;
19 }

6. Display a background overlay when the sliding panel is activated.

1 <div class="overlay"></div>
1 var instance = $('.myPanel').SlidePanel({
2   onSlideOpening: function () {
3     $(".overlay").removeClass("is-hidden").addClass("is-visible");
4   }, onSlideClosing: function () {
5     $(".overlay").removeClass("is-visible").addClass("is-hidden");
6   }
7 });
01 .navigation-overlay {
02   position: fixed;
03   top: 0;
04   right: 0;
05   bottom: 0;
06   left: 0;
07   height: 100vh;
08   background-color: rgba(34,32,32,.7);
09   z-index: 298;
10   cursor: pointer;
11 }
12  
13 .is-visible {
14   visibility: visible;
15 }
16  
17 .is-hidden {
18   display: none;
19 }

7. Insert a close button into the sliding panel.

1 <button class="slider-exit">
2   Close
3 </button>
1 var instance = $('.myPanel').SlidePanel({
2     exit_selector: ".slider-exit"
3 });

8. Create a trigger button to launch the sliding panel.

1 <button id="sliderpanel-toggle">
2   Close
3 </button>
1 var instance = $('.myPanel').SlidePanel({
2     toggle: "#sliderpanel-toggle"
3 });

9. Determine the placement of the sliding panel: top, right (default), bottom, left.

1 var instance = $('.myPanel').SlidePanel({
2     place: "left"
3 });

10. More configuration options with default values.

01 var instance = $('.myPanel').SlidePanel({
02  
03     // animation options
04     animation_duration: "0.5s",
05     animation_curve: "cubic-bezier(0.54, 0.01, 0.57, 1.03)",
06  
07     // push the main content to the other side
08     body_slide: true,
09  
10     // prevent body scroll when active
11     no_scroll: false,
12  
13     // auto dismiss when clicking a link
14     auto_close: false,
15  
16     // set title here
17     title_selector: '',
18