This time I will share jQuery Plugin and tutorial about Basic Hamburger Navigation Menu With jQuery And CSS/CSS3, hope it will help you in programming stack.
A simple, lightweight, responsive, jQuery/CSS based Hamburger Navigation system that automatically converts the normal site menu into a toggleable, mobile-friendly dropdown menu on small screens. Powered by CSS3 flexbox model and several animation properties (transition, transform).
How to use it:
1. Create the navigation menu with a hamburger toggle for your website.
01 |
< nav class = "site-nav" > |
03 |
< div class = "menu-toggle" > |
04 |
< div class = "hamburger" ></ div > |
07 |
< ul class = "open desktop" > |
08 |
< li >< a href = "#!" >Home</ a ></ li > |
09 |
< li >< a href = "#!" >Latest News</ a ></ li > |
10 |
< li >< a href = "#!" >About us</ a ></ li > |
11 |
< li >< a href = "#!" >Download Plugin</ a ></ li > |
12 |
< li >< a href = "#!" >Contact us</ a ></ li > |
2. The basic CSS styles for the hamburger navigation.
08 |
flex- direction : column; |
09 |
list-style-type : none ; |
20 |
nav li { border-bottom : 1px solid #f6f4e2 ; } |
22 |
nav li:last-child { border-bottom : none ; } |
28 |
padding : 1.5em 4em 1.5em 3em ; |
29 |
text-transform : uppercase ; |
30 |
text-decoration : none ; |
33 |
nav a:hover, nav a:focus { background : #E4B363 ; } |
40 |
color : rgba( 255 , 255 , 255 ,. 4 ); |
3. The CSS styles for menu toggle
09 |
.hamburger, .hamburger::before, .hamburger::after { |
16 |
-webkit-transition: all ease-in-out 350 ms; |
17 |
transition: all ease-in-out 350 ms; |
21 |
-webkit-transform: translateY( -7px ); |
22 |
transform: translateY( -7px ); |
26 |
-webkit-transform: translateY( 4px ); |
27 |
transform: translateY( 4px ); |
31 |
-webkit-transform: rotate( 45 deg); |
32 |
transform: rotate( 45 deg); |
35 |
.open .hamburger::before { display : none ; } |
37 |
.open .hamburger::after { |
38 |
-webkit-transform: translateY( -1px ) rotate( -90 deg); |
39 |
transform: translateY( -1px ) rotate( -90 deg); |
4. The CSS styles for the hamburger navigation on desktop (screen width > 780px).
01 |
@media ( min-width : 780px ) { |
03 |
.menu-toggle { display : none ; } |
|
source : jqueryscript.net