Hello dear Velo experts.
I’m trying to do a number counter on my website which starts counting from zero to a certain number when you open the website.
I found the code but it works only for one number. I need to do 4. can someone explain how to do it? I don’t have much experience in coding.
this is the code I’m using.
the element called “startnumber”
I need to do same with 3 more elements
$w . onReady ( function () {});
let startNum = 0 ;
let endNum = 145 ;
const duration = 20 ;
$w . onReady ( function () {
setInterval (() => {
countUp ();
}, duration );
});
function countUp ( ) {
if ( startNum <= endNum ) {
$w ( '#StartNumber' ). text = startNum . toString ();
startNum ++;
}
}