1$(function(){ 2 3 stickyNavSetup(); 4 hideNav(); 5}); 6 7 8function stickyNavSetup() { 9 10 // sticky nav 11 const sentinelEl = document.getElementById('sentinel') 12 const headerEl = document.getElementById('header') 13 const stuckClass = "stuck" 14 15 const handler = (entries) => { 16 if (headerEl) { 17 if (!entries[0].isIntersecting) { 18 headerEl.classList.add(stuckClass) 19 } else { 20 headerEl.classList.remove(stuckClass) 21 } 22 } 23 } 24 25 const observer = new window.IntersectionObserver(handler) 26 observer.observe(sentinelEl) 27} 28 29 30function hideNav(){ 31 // Hide Header on on scroll down 32 var didScroll; 33 var lastScrollTop = 0; 34 var delta = 5; 35 var navbarHeight = $('header').outerHeight(); 36 37 $(window).scroll(function(event){ 38 didScroll = true; 39 }); 40 41 setInterval(function() { 42 if (didScroll) { 43 hasScrolled(); 44 didScroll = false; 45 } 46 }, 250); 47 48 function hasScrolled() { 49 var st = $(this).scrollTop(); 50 51 // Make sure they scroll more than delta 52 if(Math.abs(lastScrollTop - st) <= delta) 53 return; 54 55 // If they scrolled down and are past the navbar, add class .nav-up. 56 // This is necessary so you never see what is "behind" the navbar. 57 if (st > lastScrollTop && st > navbarHeight){ 58 // Scroll Down 59 $('header').removeClass('nav-down').addClass('nav-up'); 60 $('.js-megamenu').attr('data-expanded', 'false'); 61 $('.js-mm-trigger').attr('data-expanded', 'false').attr('aria-expanded', 'false'); 62 63 } else { 64 // Scroll Up 65 if(st + $(window).height() < $(document).height()) { 66 $('header').removeClass('nav-up').addClass('nav-down'); 67 } 68 } 69 70 lastScrollTop = st; 71 } 72}
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.