I'm trying to loop a CSS3 transition, the idea is to add a class to the element to start the transition and listen to the transitionend event, when the event is fired I remove the class and start again.
var transition = function () {
// add class to start the transition
flipper.addClass('flipped');
flipper.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
// remove class when transition is done
flipper.removeClass('flipped');
transition();
});
}
Here is a fiddle with the code
The problem is that it only runs the first time, when the class is added a second time the event is never fired.
Is there any other way to loop a transition?