js start css animation

Solutions on MaxInterview for js start css animation by the best coders in the world

showing results for - "js start css animation"
Nishka
23 Jan 2017
1const element = document.querySelector(".yourElementClass");
2const btn = document.querySelector(".yourButtonClass");
3
4btn.onclick = () => {
5  element.style.animation = "YourAnimation 1s linear infinite"
6}
7// you will need js to start an animation, Don't forget to declare it using css