Can I reply a animation by this type of coding below in description ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can I reply a animation by this type of coding below in description ?

function play(){var m=document.getElementById("figur"); m.style.animation="shown 5s "} function replay(){ var m=document.getElementById("figur"); m.style.animation="shown 5s " } //My image's id is figur and I make a animation by the name "shown" in css using @keyframs....I call the play() and reply () function with onclick event property ,play() works but reply () not ,why?

3rd Sep 2021, 4:37 AM
RD:programmer
RD:programmer - avatar
1 Answer
+ 2
because you didn't change animation value. there are several options for animating elements by JavaScript such as Animation API https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API
3rd Sep 2021, 4:58 AM
Mehran
Mehran - avatar