How to reset a CSS animation using JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How to reset a CSS animation using JavaScript?

I have a function in JavaScript which writes into innerHTML but it only animates the first time it writes. As far as I know, animationEnd is triggered when an animation is completed in css. Is there a way to restart the animation through my JavaScript function?

7th Jul 2017, 6:45 AM
Shashikant Kadam
Shashikant Kadam - avatar
2 Answers
+ 14
Maybe it help you: https://css-tricks.com/restart-css-animation/ In this resource you will found your answer.
7th Jul 2017, 7:05 AM
noname
noname - avatar
+ 3
Thank you very much, it worked!
7th Jul 2017, 7:12 AM
Shashikant Kadam
Shashikant Kadam - avatar