Advertisement
deliciousthemes

Untitled

May 22nd, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // Responsive Navigation
  2.  
  3.     var nava = jQuery(".nav-btn"),
  4.         navb = jQuery("#navigation"),
  5.         wind = jQuery(window).width(), 
  6.         winh;
  7.  
  8.         if(wind < 1009) {
  9.              winh = jQuery(window).outerHeight()
  10.         }
  11.         else {
  12.             winh = jQuery(window).outerHeight() -jQuery('#header').outerHeight()
  13.         }
  14.  
  15.     // Add classes     
  16.     jQuery(window).resize(function () {
  17.         var nava = jQuery(".nav-btn"),
  18.             navb = jQuery("#navigation"),
  19.             wind = jQuery(window).width(),
  20.             winh;
  21.  
  22.         if(wind < 1009) {
  23.              winh = jQuery(window).outerHeight()
  24.         }
  25.         else {
  26.             winh = jQuery(window).outerHeight() -jQuery('#header').outerHeight()
  27.         }
  28.        
  29.         if (wind > 1008) {
  30.             navb.addClass("desktop");
  31.             navb.removeClass("mobile")
  32.         }
  33.         if (wind < 1009) {
  34.             navb.addClass("mobile");
  35.             navb.removeClass("desktop")
  36.         }
  37.  
  38.         // Nav CSS adjustment for mobile
  39.         if (wind < 1009) {
  40.         jQuery('#navigation.mobile').css({'max-height': winh-150, 'overflow-y': 'scroll'});
  41.         }
  42.         if (wind > 1008) {
  43.             jQuery('#navigation.desktop').css({'overflow': 'visible'});
  44.         }      
  45.  
  46.     });
  47.            
  48.         if (wind > 1008) {
  49.             navb.addClass("desktop");
  50.             navb.removeClass("mobile")
  51.         }
  52.         if (wind < 1009) {
  53.             navb.addClass("mobile");
  54.             navb.removeClass("desktop")
  55.         }  
  56.         // Nav CSS adjustment for mobile
  57.         if (wind < 1009) {
  58.         jQuery('#navigation.mobile').css({'max-height': winh-150, 'overflow-y': 'scroll'});
  59.         }
  60.         if (wind > 1008) {
  61.             jQuery('#navigation.desktop').css({'overflow': 'visible'});
  62.         }              
  63.  
  64.     // Click Tweak 
  65.     nava.click(function () {
  66.         if (navb.is(":visible")) {
  67.             navb.slideUp()
  68.         } else {
  69.             navb.slideDown()
  70.         }
  71.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement