I'm trying to make a css animation trigger with javascript.I have made the animation with @keyframes and it works. Dose anyone know how to do this without stuff like jQuery?
Here is my code:
/* Animations */
@keyframes party{
0% {background-color: red;}
10% {background-color: orange;}
20% {background-color: yellow;}
30% {background-color: green;}
40% {background-color: blue;}
50% {background-color: purple;}
}
@-webkit-keyframes party{
0% {background-color: red;}
10% {background-color: orange;}
20% {background-color: yellow;}
30% {background-color: green;}
40% {background-color: blue;}
50% {background-color: purple;}
}
.animated {animation: party 2s infinite}and then with JS you add this class to the element you want to animateanimatemethod for html elements to animate some stuff developer.mozilla.org/en-US/docs/Web/API/Element/animate