1document.addEventListener('DOMContentLoaded', () => { 2 // Ensure GSAP and ScrollTrigger are available 3 if (typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined') { 4 gsap.registerPlugin(ScrollTrigger); 5 6 7 // Select all elements marked for animation 8 const animatedBlocks = document.querySelectorAll('.animate-on-scroll'); 9 10 if (animatedBlocks.length > 0) { 11 12 // Set initial state for ALL animated blocks immediately 13 gsap.set(animatedBlocks, { 14 opacity: 0, 15 y: 50, 16 scale: 0.95 // Start slightly smaller 17 }); 18 19 animatedBlocks.forEach((block) => { 20 // *** Prevent general animation on large-centered-text block *** 21 if (block.classList.contains('wp-block-acf-large-centered-text')) { 22 // Reset its initial state set by the global gsap.set above, 23 // as intro-text-reveal.js will handle its own animation. 24 gsap.set(block, { opacity: 1, y: 0, scale: 1, clearProps: "all" }); 25 return; // Skip applying the general animation 26 } 27 // *** End prevention *** 28 29 // Animate TO the final state when triggered 30 gsap.to(block, { 31 opacity: 1, 32 y: 0, 33 scale: 1, // Animate to full size 34 duration: 0.8, 35 ease: 'power2.out', 36 scrollTrigger: { 37 trigger: block, 38 start: 'top 85%', 39 end: 'bottom 15%', 40 toggleActions: 'play none none none', 41 // markers: true, 42 once: true 43 } 44 }); 45 }); 46 } else { 47 console.log('No blocks found with .animate-on-scroll class.'); 48 } 49 } else { 50 console.error('GSAP or ScrollTrigger not found for block animations.'); 51 } 52});
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.