1jQuery(document).ready(function ($) { 2 // Here You can type your custom JavaScript... 3 4 var header = document.getElementById('site-navigation'); 5 var masthead = document.getElementById('masthead'); 6 var body = document.querySelector('body'); 7 if (header) { 8 // window.onscroll = function () { 9 // myFunction() 10 // }; 11 12 var stickyheight = header.offsetHeight; 13 var sticky = header.offsetTop + stickyheight; 14 function myFunction() { 15 if (window.pageYOffset > sticky) { 16 header.classList.add('aft-sticky-navigation'); 17 } else { 18 header.classList.remove('aft-sticky-navigation'); 19 } 20 21 if (header.classList.contains('aft-sticky-navigation')) { 22 masthead.style.paddingBottom = stickyheight + 'px'; 23 } else { 24 masthead.style.paddingBottom = 0; 25 } 26 } 27 } 28 29 var didScroll; 30 var lastScrollTop = 0; 31 var delta = 5; 32 var navbarHeight = $('#site-navigation').outerHeight(); 33 34 $(window).on('scroll', function (event) { 35 didScroll = true; 36 }); 37 38 setInterval(function () { 39 if (didScroll) { 40 hasScrolled(); 41 didScroll = false; 42 } 43 }, 250); 44 45 function hasScrolled() { 46 var st = $(this).scrollTop(); 47 48 // Make sure they scroll more than delta 49 if (Math.abs(lastScrollTop - st) <= delta) return; 50 51 // If they scrolled down and are past the navbar, add class .nav-up. 52 // This is necessary so you never see what is "behind" the navbar. 53 if (st > lastScrollTop && st > navbarHeight) { 54 // Scroll Down 55 if ( 56 body.classList.contains('scrolldown-sticky-header') || 57 body.classList.contains('scrollboth-sticky-header') 58 ) { 59 if (typeof myFunction === 'function') { 60 myFunction(); 61 } 62 $('#site-navigation').removeClass('nav-down').addClass('nav-up'); 63 } else { 64 $('#site-navigation').removeClass('nav-down').addClass('nav-up'); 65 } 66 } else { 67 // Scroll Up 68 69 if (st + $(window).height() < $(document).height()) { 70 if (typeof myFunction === 'function') { 71 myFunction(); 72 } 73 $('#site-navigation').removeClass('nav-up').addClass('nav-down'); 74 } 75 } 76 lastScrollTop = st; 77 } 78});
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.