1jQuery.noConflict(); 2 3 jQuery(function() { 4 5 // grab the initial top offset of the navigation 6 var sticky_navigation_offset_top = jQuery('#site-navigation').offset().top; 7 8 // our function that decides weather the navigation bar should have "fixed" css position or not. 9 var sticky_navigation = function(){ 10 var scroll_top = jQuery(window).scrollTop(); // our current vertical position from the top 11 12 // if we've scrolled more than the navigation, change its position to fixed to stick to top, 13 // otherwise change it back to relative 14 if (scroll_top > sticky_navigation_offset_top) { 15 jQuery('#site-navigation').addClass('fixed').css("top", -nav.outerHeight()).animate({"top": "0"}); 16 } else { 17 jQuery('#site-navigation').removeClass('fixed'); 18 } 19 }; 20 21 // run our function on load 22 sticky_navigation(); 23 24 // and run it again every time you scroll 25 jQuery(window).scroll(function() { 26 sticky_navigation(); 27 }); 28 29 });
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.