Window: animationend event

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 Window 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:

window.addEventListener('animationend', () => {
  console.log('Animation ended');
});

The same, but using the onanimationend event handler property:

window.onanimationend = () => {
  console.log('Animation ended');
};

See a live example of this event.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
animationend_event
43
1
18
≤79
Yes
No
?
9
43
≤37
43
18
Yes
?
9
4.0
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/animationend_event