Advertisement
raselmahmud24

responsive nav menu own making

Nov 5th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. html{
  2.  
  3. <nav class="nav-bar" role="navigation">
  4.                     <div class="nav-hold">
  5.                         <a href="#" class="nav-menu" id="nav-menu">&#9776;</a>
  6.                         <ul class="nav-list" id="nav">
  7.                             <li><a href="#">home</a></li>
  8.                             <li><a href="#">features</a></li>
  9.                             <li><a href="#">work</a></li>
  10.                             <li><a href="#">team</a></li>
  11.                             <li><a href="#">contact</a></li>
  12.                         </ul>
  13.                     </div>
  14.                 </nav>
  15.  
  16.  
  17. }
  18.  
  19.  
  20.  
  21. css{
  22.     make it yourself here contain media quires and other more coding
  23. }
  24.  
  25.  
  26. js{
  27.  
  28.  
  29.     var n='#nav',no='nav-open';
  30.     $('.nav-menu').click(function(){
  31.         if($(n).hasClass(no)){
  32.              var newH=$(n).css('height','auto').height();
  33.             $(n).animate({height:0},300);
  34.             setTimeout(function(){
  35.                 $(n).removeClass(no).removeAttr('style');
  36.             },320);
  37.         }else{
  38.             var newH=$(n).css('height','auto').height();
  39.             $(n).height(0).animate({height:newH},300);
  40.             setTimeout(function(){
  41.                 $(n).addClass(no).removeAttr('style');
  42.             },320);
  43.         }//else
  44.     });
  45.  
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement