0
Works for the first time only
I want to make a timer. By making a css animation that decreases the width of the blue bar till it reaches 0%. At first it asks for the animation duration and everything goes well but when I try to choose the animation duration for the second time it doesn't animate the bar width decreasing so it only works with me for the first time. https://code.sololearn.com/We2jo4xZjVYv/?ref=app
3 Antworten
+ 2
There's probably a better way to do this but what first came to mind for me was to reset the animation value to an empty string. Try inserting this line after you get the div element (var el) using querySelector but above the setTimeout.
el.style.animation = ""
+ 1
It worked thanks
0
Radwa Hamdy Glad to hear that. You're welcome.