1(function (d) { 2 3 const fade = d.querySelectorAll('.lnb-fade'); 4 5 // Create Intersection Observer 6 let options = { 7 root: null, //viewport 8 rootMargin: "0px", 9 threshold: .75 10 }; 11 12 let o = new IntersectionObserver(([fade]) => { 13 14 if (fade.isIntersecting) { 15 16 fade.target.classList.add('active'); 17 18 } 19 }, options); 20 21 22 // Test if element is already in viewport 23 function isInViewport(elem) { 24 const rect = elem.getBoundingClientRect(); 25 return ( 26 rect.top >= 0 && 27 rect.left >= 0 && 28 rect.bottom <= (window.innerHeight || d.documentElement.clientHeight) && 29 rect.right <= (window.innerWidth || d.documentElement.clientWidth) 30 ); 31 } 32 33 34 // Allow data attributes to customize transition duration & delay 35 function setDataAttributes(elem) { 36 37 let duration = elem.getAttribute('data-duration'); 38 let delay = elem.getAttribute('data-delay'); 39 40 if (duration !== null) { 41 elem.style.transitionDuration = duration + 's'; 42 } 43 44 if (delay !== null) { 45 elem.style.transitionDelay = delay + 's'; 46 } 47 48 } 49 50 51 // Set observers 52 if (fade.length !== 0) { 53 54 fade.forEach(fade => { 55 56 o.observe(fade); 57 58 // make element visible if in viewport 59 if (isInViewport(fade)) { 60 fade.classList.add('active'); 61 } 62 63 // set transition duration & delay (if applicable) 64 for (let child of fade.children) { 65 setDataAttributes(child); 66 } 67 68 }); 69 } 70})(document);
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.