Document: transitionrun event
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The transitionrun
event is fired when a CSS transition is first created, i.e. before any transition-delay
has begun.
Bubbles | Yes |
---|---|
Cancelable | No |
Interface | TransitionEvent |
Event handler property | ontransitionrun |
The original target for this event is the Element
that had the transition 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: transitionrun.
Examples
This code adds a listener to the transitionrun
event:
document.addEventListener('transitionrun', () => {
console.log('Transition is running but hasn't necessarily started transitioning yet');
});
The same, but using the ontransitionrun
property instead of addEventListener()
:
document.ontransitionrun = () => {
console.log('Transition started running');
};
Specifications
Specification |
---|
CSS Transitions Level 2 # transitionrun |
Browser compatibility
BCD tables only load in the browser
See also
- The
GlobalEventHandlers.ontransitionrun
event handler - The
TransitionEvent
interface - CSS properties:
transition
,transition-delay
,transition-duration
,transition-property
,transition-timing-function
- Related events:
transitionend
,transitionstart
,transitioncancel
- This event on
HTMLElement
targets:transitionrun
- This event on
Window
targets:transitionrun