CSS3 animate doesn’t play again on removeClass followed by addClass, but alters on toggleClass
If I do:
jQuery('#test').removeClass("change"); console.log(jQuery('#test').attr("class")); jQuery('#test').addClass("change");
animate bind to this class shows only first time.
Code in action : http://jsfiddle.net/adamovic/ato5akjx/
If you click on the button a few times, the animation doesn’t repeat. Why?
But it plays every second time, when using
Browsers tested: Chrome, Firefox
It looks like there has to be a delay between adding/remove classes.
Adding a delay of 100ms seems to work in Chrome/FF/IE.
If you’re using jQueryUI, you could also use the following: