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, ie 19 frames, the animation stops.
I want the animation to happen when the #animation div has the class "in-view". This part is already treated, and when I scroll to the div, it gains the class "in-view", however I do not arrange the form of the activate function and the animation happens.
Solutions other than JQuery.
Thank you!