Execute code when reached to the destination div.
Budget: ₹600 – ₹1,500 INR
I have an animated counter , want to execute it once, user scroll window & reach to that destination div.
Here's Code:
const AtimerStarts = setInterval(timerMoves);
var startup = 0;
function timerMoves(){
var timers = document.querySelectorAll("#counter");
timers.forEach(timer => {
var endup = 1000;
timer.innerHTML= ++startup;
if(startup===endup)
{
clearInterval(AtimerStarts);
}
})
}
( <h4 class="user-timer" id="counter" ends_at="1000" starts_at="1" style="text-align: center;">0</h4> )
Here's Code:
const AtimerStarts = setInterval(timerMoves);
var startup = 0;
function timerMoves(){
var timers = document.querySelectorAll("#counter");
timers.forEach(timer => {
var endup = 1000;
timer.innerHTML= ++startup;
if(startup===endup)
{
clearInterval(AtimerStarts);
}
})
}
( <h4 class="user-timer" id="counter" ends_at="1000" starts_at="1" style="text-align: center;">0</h4> )