A web doubt...game... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A web doubt...game...

I have code below related game in which I want if someone stop the yellow div left to the white it come to right wrt white strip. I have applied if left <0 stop the animation and left =100(right to white strip) Now it stop the animation but the div is not shifting to right.. Enlight my mistake or any idea... https://code.sololearn.com/WCGIHG79ZmOP/?ref=app

10th Mar 2021, 12:45 PM
Divya Mohan
Divya Mohan - avatar
3 Answers
+ 2
is this code doing what you're expecting (your description is quite unclear)? https://code.sololearn.com/W39qSXsk5R8F/?ref=app I just have added: obj.style.animation = "none"; ... else paused css animation seems to prevent changing animated (yet frozen) attribute ^^
10th Mar 2021, 3:44 PM
visph
visph - avatar
+ 1
no, these are not all the same... animation = "" will only delete the inlined (style attribute of element) css property, but external css will be applied... animation = "none" overide external css, as has higher precedence of any rules (except those marked with !important) animationPlaystate = "paused" will only freeze the animation to its actual state...
10th Mar 2021, 4:09 PM
visph
visph - avatar
0
Ok 👌 it's resolved now! You get it. A more query @visph What is difference if we put animation = " " Or animation = "none" Or animationPlaySate = "paused" Isn't all are same ? mean remove the animation from element.
10th Mar 2021, 3:57 PM
Divya Mohan
Divya Mohan - avatar