W3cubDocs

/Web APIs

Window: transitionend event

The transitionend event is fired when a CSS transition has completed. In the case where a transition is removed before completion, such as if the transition-property is removed or display is set to none, then the event will not be generated.

Bubbles Yes
Cancelable Yes
Interface TransitionEvent
Event handler property ontransitionend

The transitionend event is fired in both directions - as it finishes transitioning to the transitioned state, and when it fully reverts to the default or non-transitioned state. If there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. If the transitioncancel event is fired, the transitionend event will not fire.

The original target for this event is the Element that had the transition 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: transitionend.

Examples

This code adds a listener to the transitionend event:

window.addEventListener('transitionend', () => {
  console.log('Transition ended');
});

The same, but using the ontransitionend property instead of addEventListener():

window.ontransitionend = () => {
  console.log('Transition 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
transitionend_event
No
No
51
No
No
13.1
No
No
51
No
13.4
No

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/transitionend_event