Isaiah Bugarin
Isaiah Bugarin

Reputation: 493

How to run animation via Javascript?

I have an animation in CSS that is a '-moz-keyframe' animation. I can't seem to find any function in Javascript that will run the animation. How do I do it?

Upvotes: 0

Views: 86

Answers (2)

Kevin Ennis
Kevin Ennis

Reputation: 14456

Create a CSS class that contains nothing but the rules for the animation. Then just add/remove that class with JavaScript.

Upvotes: 1

Robby Shaw
Robby Shaw

Reputation: 4915

It is Mozilla CSS. You don't need to have a JS code for this animation. Just use the CSS attribute on the element. Check out this example: https://developer.mozilla.org/samples/cssref/animations/cssanim1.html

You can check more information at Mozilla CSS animations

Upvotes: 1

Related Questions