I'm trying to get a CSS3 animation to animate every time a function is called.
My CSS code for the animation is in a class called 'enable' and it simply starts the animation.
My FUNCTIONS code is as follows:
document.getElementById("red").className = "enable";
setTimeout(function() {
document.getElementById("red").className = "";
}, 1000);
That works properly when using the setTimeout function but when i change the entire FUNCTIONS code to say like this:
document.getElementById("red").className = "";
document.getElementById("red").className = "enable";
It only works once.
Why can't I remove the class and then add it immediately after. Why doesn't my second code do the same thing as the first one?
Thanks in advanced!