1// Adjust when mp-fixed-header is applied 2 jQuery(document).ready( function($){ 3 4 var header_offset = 200; 5 var $custom_header = $('#custom-header'); 6 var lastScrollPosition = window.scrollY; 7 var newScrollPosition = 0; 8 var userScrollingUp = 0; 9 10 // Remove fixed header class on page load 11 $custom_header.removeClass('mp-fixed-header'); 12 13 // On window scroll, check position 14 $(window).scroll(function() { 15 16 // Keep track of Scroll Direction 17 newScrollPosition = window.scrollY; 18 if( newScrollPosition < lastScrollPosition ) { 19 userScrollingUp = userScrollingUp + 1; 20 } else { 21 userScrollingUp = 0; 22 } 23 lastScrollPosition = newScrollPosition; 24 25 // Apply Fixed Header Class - If within the header offset, or if user scrolls up 26 if( $(window).scrollTop() < header_offset ) { 27 $custom_header.removeClass('mp-fixed-header'); 28 userScrollingUp = 0; 29 } else if( userScrollingUp > 20 ) { 30 $custom_header.removeClass('mp-fixed-header'); 31 } else { 32 $custom_header.addClass('mp-fixed-header'); 33 } 34 35 }); // END $(window).scroll(function() 36 37 }); // END (document).ready( function($) 38
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.