animationend Event
Example
After the CSS animation ends, for the
var x = document.getElementById("myDIV");
// Chrome, Safari and Opera code
x.addEventListener("webkitAnimationEnd", myStartFunction);
// Standard syntax
x.addEventListener("animationend", myStartFunction);
Try it »
Definition and Usage
The animationend event is triggered after a CSS animation completes.
For more about CSS animations, please see our CSS3 Animations section.
When a CSS animation plays, the following three events occur:
- animationstart - Triggered when the CSS animation starts
- animationiteration - Triggered when the CSS animation repeats
- animationend - Triggered when the CSS animation completes
Browser support
The numbers in the table indicate the version number of the first browser to support the event.
The number specified after "webkit" or "moz" is the prefix of the first version to support the event.
| Events | |||||
|---|---|---|---|---|---|
| animationend | 4.0 webkit | 10.0 | 16.0 | ||
| 5.0 moz | 4.0 webkit | 15.0 webkit | |||
| 12.1 |
Note: The Chrome, Safari and Opera browsers use the webkitAnimationEnd prefix.
Syntax
object.addEventListener("webkitAnimationEnd",
myScript
); // Chrome, Safari and Opera
object
.addEventListener("animationend",
myScript
); // Standard syntax
Note: Internet Explorer 8 and earlier IE versions do not support addEventListener() method.
Technical Details
| Does it support bubbling: | Yes |
|---|---|
| Is it cancelable: | No |
| Event type: | AnimationEvent |
Related pages
CSS Tutorial: CSS3 Animations
CSS Reference Manual: CSS3 Animation Properties
HTML DOM Reference Manual: Style Animation Properties
Event Object