Fix: Remove duplicate CSS, fix counter animation, ensure modals are hidden
This commit is contained in:
parent
1524944b52
commit
0c61760313
25
script.js
25
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
|
||||
|
|
|
|||
11
styles.css
11
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
|
||||
======================================== */
|
||||
|
|
|
|||
Loading…
Reference in New Issue