+ 1

Is there a way to add @keyframe animation in a JS function?

30th Sep 2018, 1:18 PM
Bold Pilot
Bold Pilot - avatar
4 odpowiedzi
+ 1
It can be approximated in CSS through pseudo classes such as ":focus" which you can experiment with. The cleaner way to use onclick, as you suggested. https://www.w3schools.com/TAGS/ev_onclick.asp
30th Sep 2018, 2:10 PM
Janning⭐
Janning⭐ - avatar
0
I don't think it is possible in css, there are click and hover scopes but i don't think you are looking for them. There is however the onclick attribute in html, which refers to a js code. however the script must be written in the html file itself
30th Sep 2018, 1:52 PM
CodeMStr
CodeMStr - avatar
0
Janning there must be easy way of coding that bridges animation to function.For ex: If I click button x and want to change backcolor of button y Then CSS becomes insufficient.That is the problem.Because you can only change backcolor of what you selected as selector.If I don't select button y , then it is impossible to change color of button y for CSS.There is no bridge to other elements without selecting related component.So, JS must be used but how?
30th Sep 2018, 11:11 PM
Bold Pilot
Bold Pilot - avatar
0
Well, if you're convinced about the no CSS thing, that's your prerogative. However, the link provided does include JS for onclick in the Try It, so I would recommend getting a good foundation in HTML vs CSS vs JS so you can tell when one ends and the other begins.
1st Oct 2018, 1:12 AM
Janning⭐
Janning⭐ - avatar