Fix: Remove duplicate CSS, fix counter animation, ensure modals are hidden
This commit is contained in:
parent
1524944b52
commit
0c61760313
23
script.js
23
script.js
|
|
@ -72,20 +72,31 @@ function initCounters() {
|
||||||
const animateCounter = (counter) => {
|
const animateCounter = (counter) => {
|
||||||
const target = parseFloat(counter.getAttribute('data-target'));
|
const target = parseFloat(counter.getAttribute('data-target'));
|
||||||
const duration = 2000;
|
const duration = 2000;
|
||||||
const step = target / (duration / 16);
|
const startTime = performance.now();
|
||||||
let current = 0;
|
|
||||||
|
|
||||||
const updateCounter = () => {
|
const updateCounter = (currentTime) => {
|
||||||
current += step;
|
const elapsed = currentTime - startTime;
|
||||||
if (current < target) {
|
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);
|
counter.textContent = current.toFixed(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (progress < 1) {
|
||||||
requestAnimationFrame(updateCounter);
|
requestAnimationFrame(updateCounter);
|
||||||
} else {
|
} else {
|
||||||
counter.textContent = target;
|
counter.textContent = target;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateCounter();
|
requestAnimationFrame(updateCounter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use Intersection Observer to trigger animation
|
// Use Intersection Observer to trigger animation
|
||||||
|
|
|
||||||
11
styles.css
11
styles.css
|
|
@ -1518,17 +1518,6 @@ body {
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================
|
|
||||||
Service Modals - Hide by default
|
|
||||||
======================================== */
|
|
||||||
.service-modal {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.service-modal.active {
|
|
||||||
display: flex !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================
|
/* ========================================
|
||||||
Service Status Checking
|
Service Status Checking
|
||||||
======================================== */
|
======================================== */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue