heroweb/poc/in/assets/js/count-to.js
2024-09-02 07:28:06 +02:00

15 lines
338 B
JavaScript

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;
}
});