1jQuery(document).ready(function($) { 2 3 // Set margin-top on .site-inner 4 function siteInnerTopMargin(){ 5 var navHeight = $('.site-header').outerHeight(); 6 7 // If Primary Nav is being used, apply top margin to that 8 if ( $( "nav.nav-primary" ).length ) { 9 $( "nav.nav-primary" ).css("margin-top", navHeight); 10 }else{ 11 // otherwise apply top margin to .site-inner div 12 $('.site-inner').css("margin-top", navHeight); 13 } 14 15 } 16 siteInnerTopMargin(); 17 18 19 20 // Optimization: Store the references outside the event handler: 21 var $window = $(window); 22 23 24 /* // STICKY NAV // */ 25 // Do sticky nav on smartscroll 26 jQuery(window).smartscroll(function(e){ 27 28 var windowsize = $window.width(); 29 if (windowsize > 800) { 30 //sticky nav 31 32 33 var elemHeight = $('.site-header').outerHeight() + 20; 34 35 var scroll = $(window).scrollTop(); 36 37 if (scroll >= elemHeight) { 38 $(".site-header").addClass("sticky"); 39 40 setTimeout(function() { 41 $(".site-header").addClass("active"); 42 }); 43 44 } else { 45 $(".site-header").removeClass("sticky").removeClass("active"); 46 } 47 48 }else{ 49 //no sticky nav on mobile 50 } 51 52 }); 53 54 // Execute functions on smartresize 55 jQuery(window).smartresize(function(e){ 56 siteInnerTopMargin(); 57 }); 58 59 60});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.