HTML onanimationcancel Event Attribute
Description
The onanimationcancel event attribute runs a script when a CSS animation stops unexpectedly, without reaching animationend: for example when the animation-name is removed or changed, or the element gets display: none or is removed from the document.
The event is an AnimationEvent with the properties animationName (the name of the @keyframes rule), elapsedTime (in seconds, not counting animation-delay) and pseudoElement (for example "::before"). Animation events bubble, so one handler on a parent can watch all of its children; check event.target to see which element is animating.
Syntax
<element onanimationcancel="script">
Values
- scriptThe name of the script to use when the event has been triggered.
Example
Browser Support
The following information will show you the current browser support for the HTML onanimationcancel event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.
Desktop





Tablets & Mobile





