I'm calling an animation like this:
document.getElementById('banner').className = "changeColorToIndigo";
Then I've got the CSS property:
div.changeColorToIndigo {
animation-duration: 1s;
animation-name: changeColorToIndigo;
animation-fill-mode: forwards;
}
And the keyframes animation:
@keyframes changeColorToIndigo {
from {background-color: #00BBD2;}
to {background-color: #3F51B5;}
}
But the animation goes back to it's initial state after the animation has completed, why is that? I've set the fill mode to forwards and specified the to
(100%) property.
I've put your code in a Fiddle, and it works fine for me
HTML
CSS
jQuery