// Function to animate counters function animateCounters() { const counters = document.querySelectorAll('.counter'); counters.forEach(counter => { const target = +counter.getAttribute('data-target'); const increment = target / 300; // Adjust the speed of counting let count = 0; const updateCounter = () => { count += increment; if (count < target) { counter.textContent = Math.ceil(count) + '+'; // Add the plus symbol requestAnimationFrame(updateCounter); } else { counter.textContent = target + '+'; // Ensure exact number with + } }; updateCounter(); }); } function resetCounters() { const counters = document.querySelectorAll('.counter'); counters.forEach(counter => { counter.textContent = '0+'; // Reset to zero with a plus symbol }); setTimeout(animateCounters, 500); // Delay before restarting } animateCounters(); setInterval(resetCounters, 8000);