From 6ba842fea7252eba4429ca71964ce91da312a724 Mon Sep 17 00:00:00 2001 From: Michael Victory Date: Mon, 22 Jun 2026 23:00:41 -0700 Subject: [PATCH] Inga stats: fire count-up after the section reveal so the increment is visible The count was triggered on the tiny number spans at the same moment the section began fading in, so 0->100 happened while the wrap was still opacity 0 and you only saw the tail. Observe the .stats block at threshold .6 (fires once it's truly on-screen, after the reveal) and run regardless of reduced-motion. Co-Authored-By: Claude Opus 4.8 --- index.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 96ab083..06fff2d 100644 --- a/index.html +++ b/index.html @@ -322,12 +322,14 @@ onScroll(); window.addEventListener('scroll', onScroll, { passive: true }); } - // count the proof numbers up when they scroll into view + // count the proof numbers up when the stats block is discovered (after its reveal, + // so the increment is actually on-screen — not hidden behind the fade-in) + var statsEl = document.querySelector('.stats'); var counters = [].slice.call(document.querySelectorAll('[data-count]')); - if (counters.length && !rm && 'IntersectionObserver' in window) { + if (statsEl && counters.length && 'IntersectionObserver' in window) { counters.forEach(function (c) { c.textContent = '0'; }); var run = function (el) { - var to = parseInt(el.getAttribute('data-count'), 10), dur = 1500, t0 = null; + var to = parseInt(el.getAttribute('data-count'), 10), dur = 1600, t0 = null; var tick = function (ts) { if (!t0) t0 = ts; var p = Math.min((ts - t0) / dur, 1), e = 1 - Math.pow(1 - p, 3); @@ -336,10 +338,15 @@ }; requestAnimationFrame(tick); }; + var started = false; var nio = new IntersectionObserver(function (es) { - es.forEach(function (e) { if (e.isIntersecting) { run(e.target); nio.unobserve(e.target); } }); - }, { threshold: 0.5 }); - counters.forEach(function (c) { nio.observe(c); }); + es.forEach(function (e) { + if (e.isIntersecting && !started) { started = true; counters.forEach(run); nio.disconnect(); } + }); + }, { threshold: 0.6 }); + nio.observe(statsEl); + } else { + counters.forEach(function (c) { c.textContent = c.getAttribute('data-count'); }); } })();