Animation On Click | SoloLearn: Learn to code for FREE!

+2

Animation On Click

I'm trying to create an animation that is triggered when a button is pressed but it doesn't work. What's wrong with my code? https://code.sololearn.com/WgGK1REOmkie/?ref=app

3/3/2020 8:47:23 AM

Unrealistic Engineer

13 Answers

New Answer

+4

https://code.sololearn.com/Wiq89K316l3E/?ref=app theres a better way of doing this is by using css transition,

+3

here;s more simpler way of doing this. feel free to studying it https://code.sololearn.com/Wy0pTSQ8Y227/?ref=app

+1

Thank you! It seems to work but it still says that there's an unexpected end of input on line 11. Is there a way to fix that?

+1

you have <script> tag in there, remove it

+1

I'm actually using your fixed version. It says that there's something wrong on line 11.

+1

Interesting. The error comes only when I press the button. It works without errors when I click any random spot of the page.

+1

oooh i see, i didnt really paid attention to the structure. i've edited the code again

+1

Shouldn't it work only when the button is pressed?

+1

Perfect, thank you very much! Now I have to study what I did wrong. 😀

+1

yes your original code put click listener on the window. thats why i remove it. there's also a mistake in <button onclick

+1

Awesome, thank you very much! 😀

+1

Line 6 'our block element'

+1

Css maybe