From 0c61760313619263070885f68a35f36bf1fcb49f Mon Sep 17 00:00:00 2001 From: ImpulsiveFPS Date: Sun, 1 Feb 2026 17:33:36 +0100 Subject: [PATCH] Fix: Remove duplicate CSS, fix counter animation, ensure modals are hidden --- script.js | 25 ++++++++++++++++++------- styles.css | 11 ----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/script.js b/script.js index 9d61442..0c948fe 100644 --- a/script.js +++ b/script.js @@ -72,20 +72,31 @@ function initCounters() { const animateCounter = (counter) => { const target = parseFloat(counter.getAttribute('data-target')); const duration = 2000; - const step = target / (duration / 16); - let current = 0; - - const updateCounter = () => { - current += step; - if (current < target) { + const startTime = performance.now(); + + const updateCounter = (currentTime) => { + const elapsed = currentTime - startTime; + const progress = Math.min(elapsed / duration, 1); + + // Easing function for smooth animation + const easeOutQuart = 1 - Math.pow(1 - progress, 4); + const current = target * easeOutQuart; + + // Format based on target value + if (target % 1 === 0) { + counter.textContent = Math.round(current); + } else { counter.textContent = current.toFixed(1); + } + + if (progress < 1) { requestAnimationFrame(updateCounter); } else { counter.textContent = target; } }; - updateCounter(); + requestAnimationFrame(updateCounter); }; // Use Intersection Observer to trigger animation diff --git a/styles.css b/styles.css index a89daa1..531555c 100644 --- a/styles.css +++ b/styles.css @@ -1518,17 +1518,6 @@ body { color: var(--color-text); } -/* ======================================== - Service Modals - Hide by default - ======================================== */ -.service-modal { - display: none !important; -} - -.service-modal.active { - display: flex !important; -} - /* ======================================== Service Status Checking ======================================== */