0
Good,
I have the following code that runs a sequence of images:
var setInter = null
function startAnimation() {
var frames = document.getElementById("animation").children;
var frameCount = frames.length;
var i = 0;
setInter = setInterval(function () {
frames[i % frameCount].style.display = "none";
frames[++i % frameCount].style.display = "block";
if(i>=18){
clearInterval(setInter);
}
}, 100);
}
This runs an animation by frames, and when the condition happens, that is 19 frames, the animation stops.
I want the animation to happen when the div #Animation has the class "in-view". This part is already taken, and when I scroll to the div, it gains the class "in-view", however I do not arrange form of the function activate and animation happen.
Solutions other than Jquery.
Thank you!
How’s the code that adds the class
in-view
? I would have been able to put him in your question?– NoobSaibot
When you scroll up to the div, you can’t call the function
startAnimation()
?– Sam