1// animate-on-scroll.js 2export function initAnimateOnScroll() { 3 const animatedElements = document.querySelectorAll("[data-animate]"); 4 5 const observer = new IntersectionObserver( 6 (entries, observerInstance) => { 7 entries.forEach((entry) => { 8 if (entry.isIntersecting) { 9 const el = entry.target; 10 const animationClasses = el.dataset.animate; 11 12 el.classList.add("animate__animated"); 13 animationClasses.split(" ").forEach((cls) => { 14 el.classList.add(cls); 15 }); 16 17 observerInstance.unobserve(el); 18 } 19 }); 20 }, 21 { 22 threshold: 0.1, 23 } 24 ); 25 26 animatedElements.forEach((el) => { 27 observer.observe(el); 28 }); 29}
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.