The animationend
event is fired when a CSS Animation has completed. If the animation aborts before reaching completion, such as if the element is removed from the DOM or the animation is removed from the element, the animationend
event is not fired.
Bubbles | Yes |
---|---|
Cancelable | No |
Interface | AnimationEvent |
Event handler property | onanimationend |
The original target for this event is the Element
that had the animation applied. You can listen for this event on the Document
interface to handle it in the capture or bubbling phases. For full details on this event please see the page on HTMLElement: animationend.
Examples
This example listens for the animationend
event:
document.addEventListener('animationend', () => { console.log('Animation ended'); });
The same, but using the onanimationend
event handler property:
document.onanimationend = () => { console.log('Animation ended'); };
See a live example of this event.
Specifications
Specification | Status | Comment |
---|---|---|
CSS Animations | Working Draft | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
animationend event | Chrome Full support 43 | Edge Full support 12 | Firefox Full support Yes | IE Full support 10 | Opera Full support 30 | Safari Full support 9 | WebView Android Full support 43 | Chrome Android Full support 43 | Firefox Android Full support Yes | Opera Android Full support 30 | Safari iOS Full support 9 | Samsung Internet Android Full support 4.0 |
Legend
- Full support
- Full support
See also
- CSS Animations
- Using CSS Animations
AnimationEvent
- Related events:
animationstart
,animationcancel
,animationiteration
- This event on
Window
targets:animationend
- This event on
HTMLElement
targets:animationend