If I do this:
jQuery('#test').removeClass("change"); console.log(jQuery('#test').attr("class")); jQuery('#test').addClass("change");
CSS3 animate binding to this class is displayed only for the first time.
.change { ... animation: redToTransparent 1s; animation-play-state: running; -webkit-animation: redToTransparent 1s; -webkit-animation-play-state: running; }
Code in action : http://jsfiddle.net/adamovic/ato5akjx/
If you press the button several times, the animation will not be repeated. Why?
But it plays every second time when using .toggleClass() .
Browsers tested: Chrome, Firefox
source share