Simple Sliding Sidebar Panels with jQuery Sidebar - Download Simple Sliding Sidebar Panels with jQuery - Sidebar

Download Simple Sliding Sidebar Panels with jQuery – Sidebar

Posted on

This time I will share jQuery Plugin and tutorial about Simple Sliding Sidebar Panels with jQuery – Sidebar, hope it will help you in programming stack.

Simple Sliding Sidebar Panels with jQuery Sidebar - Download Simple Sliding Sidebar Panels with jQuery - Sidebar
File Size: 12.4 KB
Views Total: 10440
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Sidebar is a simple lightweight jQuery plugin to create vertical or horizontal sidebars sliding out form any edge of your browser screen. Ideal for mobile app-style togglable sidebar menu to improve the content readability on small screen devices.

How to use it:

1. Include jQuery Javascript library and the jQuery sidebar plugin at the bottom of your document.

1 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
2 <script src="src/jquery.sidebar.js"></script>

2. Create the content for your sidebar panel.

1 <div class="sidebar left">
2   ...
3 </div>

3. Create a link to toggle the sidebar.

1 <a href="#" class="sidebar">Toggle</a>

4. Bind the click event to the toggle link and trigger the open event on the sliding sidebar.

1 $(".sidebar").on("click", function () {
2   $(".sidebar.left").sidebar().trigger("sidebar:open");
3 });

5. Style the sidebar panel whatever you like via CSS.

01 .sidebar.left {
02   position: fixed;
03   top: 0;
04   left: 0;
05   bottom: 0;
06   width: 270px;
07   background: rgb(68, 68, 68, .9);
08   color: white;
09   padding: 30px;
10   box-shadow: 0 0 5px black;
11   font-size: 31px;
12   text-align: center;
13 }

6. Available options.

01 $(".sidebar.right").sidebar({
02  
03 // <a href="https://www.jqueryscript.net/animation/">Animation</a> speed
04 speed: 200,
05  
06 // Side: left|right|top|bottom
07 side: "right",
08  
09 // Is closed
10 isClosed: false,
11  
12 // Should I close the sidebar?
13 close: true
14  
15 });

7. Trigger events

1 // open a sidebar
2 $(".sidebar.left").sidebar().trigger("sidebar:open");
3  
4 // close a sidebar
5 $(".sidebar.left").sidebar().trigger("sidebar:close");
6  
7 // toggle a sidebar
8 $(".sidebar.left").sidebar().trigger("sidebar:toggle");

Change logs:

2015-09-17

  • v3.3.2

2015-07-20

  • v3.3.0

2015-04-29

  • v3.2.0

2015-04-17

  • v3.1.0

2014-12-26


This awesome jQuery plugin is developed by jillix. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net