The animationstart
event is fired when a CSS Animation has started. If there is an animation-delay
, this event will fire once the delay period has expired. A negative delay will cause the event to fire with an elapsedTime
equal to the absolute value of the delay (and, correspondingly, the animation will begin playing at that time index into the sequence).
Bubbles | Yes |
Cancelable | No |
Interface | AnimationEvent
|
Event handler property | onanimationstart
|
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: animationstart.
Examples
This listens for the animationstart
event and logs a message when it is fired:
window.addEventListener('animationstart', () => {
console.log('Animation started');
});
The same, but using onanimationstart
:
window.onanimationstart = () => {
console.log('Animation started');
};
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
animationstart event
|
Chrome Full support 43 Full support 43 Full support 1 Prefixed' Implemented with the vendor prefix: webkit |
Edge Full support ≤79 Full support ≤79 Full support ≤79 Prefixed' Implemented with the vendor prefix: webkit |
Firefox
Full support 51 |
IE
? |
Opera
? |
Safari
Full support 9 |
WebView Android Full support 43 Full support 43 Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
Chrome Android Full support 43 Full support 43 Full support 18 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android
Full support 51 |
Opera Android
? |
Safari iOS
Full support 9 |
Samsung Internet Android Full support 4.0 Full support 4.0 Full support 1.0 Prefixed' Implemented with the vendor prefix: webkit |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
See also
- CSS Animations
- Using CSS Animations
AnimationEvent
- Related events:
animationend
,animationiteration
,animationcancel
- This event on
Document
targets:animationstart
- This event on
HTMLElement
targets:animationstart
Window: animationstart event by Mozilla Contributors is licensed under CC-BY-SA 2.5.