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