heroweb/poc/in/assets/js/count-to.js

15 lines
338 B
JavaScript
Raw Normal View History

2024-09-02 05:28:06 +00:00
let numbers = document.querySelectorAll("[countTo]");
numbers.forEach(number => {
let ID = number.getAttribute("id");
let value = number.getAttribute("countTo");
const countUp = new CountUp(ID, value);
if (!countUp.error) {
countUp.start();
} else {
console.error(countUp.error);
number.innerHTML = value;
}
});