Android style Offcanvas Sidebar Navigation with jQuery CSS3 - Download Android-style Offcanvas Sidebar Navigation with jQuery and CSS3

Download Android-style Offcanvas Sidebar Navigation with jQuery and CSS3

Posted on

This time I will share jQuery Plugin and tutorial about Android-style Offcanvas Sidebar Navigation with jQuery and CSS3, hope it will help you in programming stack.

Android style Offcanvas Sidebar Navigation with jQuery CSS3 - Download Android-style Offcanvas Sidebar Navigation with jQuery and CSS3
File Size: 14.6 KB
Views Total: 21166
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Yet another off-canvas menu system that helps you create a toggleable sidebar navigation that behaves like a native side navigation as you seen on Android apps. 

How to use it:

1. Create an element to toggle the sidebar navigation.

1 <div id="mobile-nav"></div>

2. Create the sidebar navigation from a nav list.

01 <nav>
02   <ul class="menu">
03     <li><a href="#">Home</a></li>
04     <li><a href="#">Works</a></li>
05     <li><a href="#">Services</a></li>
06     <li><a href="#">Blog</a></li>
07     <li><a href="#">About</a></li>
08     <li><a href="#">Contact</a></li>
09   </ul>
10 </nav>

3. The basic CSS styles for the sidebar navigation.

01 .menu {
02   list-style: none;
03   line-height: 42px;
04   margin: auto;
05   padding-left: 0;
06   width: 15em;
07 }
08  
09 .menu a {
10   background: url(icons.png) no-repeat left top;
11   color: #ddd;
12   text-decoration: none;
13   text-transform: uppercase;
14   display: block;
15   padding-left: 3em;
16   width: 100%;
17 }
18  
19 .menu a:hover {
20   margin-left: 1em;
21   -webkit-transition: all .5s;
22   -o-transition: all .5s;
23   transition: all .5s;
24 }
25  
26 .menu li {
27   box-shadow: 3px 0 rgba(52,152,219,.2) inset;
28   margin-bottom: 5px;
29   padding-left: .5em;
30   -webkit-transition: all .5s;
31   -o-transition: all .5s;
32   transition: all .5s;
33 }

4. Style the active / inactive state of the sidebar navigation.

01 nav {
02   background: rgba(41,128,185,1);
03   padding-right: .25em;
04   position: absolute;
05   left: -18em;
06   top: 0;
07   padding-top: 5em;
08   box-sizing: border-box;
09   z-index: 20;
10   height: 100%;
11   -webkit-transition: all .3s;
12   -o-transition: all .3s;
13   transition: all .3s;
14 }
15  
16 nav.active { left: 0; }

5. The JavaScript to show / hide the sidebar navigation by toggling the ‘active’ class. Add the following JavaScript snippet after jQuery library and done.

1 $('#mobile-nav').click(function(event) {
2   $('nav').toggleClass('active');
3 });

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

source : jqueryscript.net