10

I have a question about CSS3. Is there an option to reset the animation after it finish (for example by using jQuery)?

Example: after button click, animation reset.

Amay
  • 1,461
  • 5
  • 27
  • 56

2 Answers2

8

I found better solution:

$('something').removeClass('anim').animate({'nothing':null}, 1, function () {
$(this).addClass('anim');
});

It's working. Ofc it need a css class '.anim' with the animation.

Amay
  • 1,461
  • 5
  • 27
  • 56
-1

This question is old, but i figured out a nice way to restart a css3 animation with jQuery while i was working on a project, and now i want to share. here is the trick:

$('#anim-div').replaceWith($('#anim-div'));

and this will restart the animation on '#anim-div', it works.

Pouya
  • 159
  • 1
  • 6