diff --git a/script.js b/script.js index bf4f299..7344b5a 100644 --- a/script.js +++ b/script.js @@ -549,11 +549,11 @@ var si = 0, entries.forEach(function (entry) { if (!entry.isIntersecting) return; var grid = entry.target; - if (animated[grid.dataset.section]) return; - animated[grid.dataset.section] = true; - var items = grid.children; + var key = grid.className || 'anon'; + if (animated[key]) return; + animated[key] = true; gsap.fromTo( - items, + grid.children, { y: 30, opacity: 0 }, { y: 0, @@ -565,14 +565,13 @@ var si = 0, } ); }); - }, { threshold: 0.12, rootMargin: '0px 0px -40px 0px' }); + }, { threshold: 0.1 }); var grids = document.querySelectorAll( '.features-grid, .faq-grid, .pricing-grid, .blog-grid, .biz-wizard .container' ); grids.forEach(function (g) { - g.dataset.section = g.className || 'anon'; - /* Pre-set children to hidden state so they start invisible */ + /* Pre-set children invisible so no flash even before observer fires */ gsap.set(g.children, { y: 30, opacity: 0 }); observer.observe(g); });