animationstart begivenhed
Definition and usage
The animationstart event occurs when the CSS animation starts playing.
For more knowledge about CSS animations, please study our CSS3 animation tutorial.
Three events may occur when the CSS animation plays:
- animationstart - Occurs when the CSS animation starts
- animationiteration - Occurs when the CSS animation repeats
- animationend - Occurs when the CSS animation is completed
Example
Do something to the <div> element when the CSS animation starts:
var x = document.getElementById("myDIV"); // Code for Chrome, Safari, and Opera x.addEventListener("webkitAnimationStart", myStartFunction); // Standard syntax x.addEventListener("animationstart", myStartFunction);
Syntax
object.addEventListener("webkitAnimationStart", myScript); // Code for Chrome, Safari, and Opera object.addEventListener("animationstart", myScript); // Standard syntax
Note:Internet Explorer 8 or earlier versions do not support addEventListener() method.
Technical details
Bubble: | Supported |
---|---|
Cancellable: | Not supported |
Event type: | AnimationEvent |
DOM version: | Level 3 Events |
Browser support
The numbers in the table indicate the first browser version that fully supports the event.
The 'webkit' or 'moz' after the number indicates the first version with the prefix used.
Event | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
animationstart | 4.0 webkit | 10.0 | 16.0 5.0 moz |
4.0 webkit | 15.0 webkit 12.1 |
Note:For Chrome, Safari, and Opera, use webkitAnimationEnd.
Related pages
CSS tutorial:CSS3 animation
CSS reference manual:CSS3 animation egenskab
HTML DOM referencehåndbog:Style animation egenskab