+ 7
Can I call a CSS animation onclick?
I want to make an animation that starts when you click a button, but I don't know if it's posible to use CSS animation or the only choice is creating the animation with Javascript, could you please help me?
5 Respostas
+ 17
a:active {
animation:…;
}
(try pseudo-events like : active,hover,visited,link……)
+ 7
Thank you so much😊
+ 5
Check this out
They have explained it beautifully :
http://stackoverflow.com/q/21919044/4166696
+ 3
You will need JavaScript yes, but only to modify the CSS code onclick. So, your onclick event will change the CSS code from what it is, to what you want it to be, thus creating the animation. It is however better to just animate using JQuery, a library of JavaScript.
+ 3
You can avoid JS to perform an animation/transition between two state on a click, by using <input>s type checkbox/radio in combination with <label>s and/or <a>s links and their particular behaviours associated with css pseudo-classes ( look at properies/pseudo-classes 'checked', 'target' and so on... )