Favorites

HTML ontransitionrun Event Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
ontransitionrun
HTML Event AttributeThis event attribute is supported by all modern browsers.
Updated 22nd November 2026

Description

The ontransitionrun event attribute runs a script when a CSS transition is created, as soon as a transitioned property changes and before any transition-delay has passed.

The event is a TransitionEvent with the properties propertyName (the CSS property, for example "transform"), elapsedTime (in seconds, not counting transition-delay) and pseudoElement. A separate event fires for each transitioned property, so a transition on all that changes three properties fires three events; check event.propertyName to handle only one. Transition events bubble.

Syntax

<element ontransitionrun="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE html>
<html>
<head>
<title>ontransitionrun event</title>
<style>
#box {
width: 60px;
height: 60px;
background: #4361ee;
transition: transform 1s 0.5s, background-color 1s;
}
#box.moved {
transform: translateX(200px);
background-color: #f72585;
}
</style>
</head>
<body>
<button onclick="document.getElementById('box').classList.toggle('moved')">Toggle transition</button>
<p>Click again during the transition to cancel it.</p>
<div id="box" ontransitionrun="log('transitionrun: ' + event.propertyName)" ontransitionstart="log('transitionstart: ' + event.propertyName)" ontransitionend="log('transitionend: ' + event.propertyName + ' (' + event.elapsedTime + 's)')" ontransitioncancel="log('transitioncancel: ' + event.propertyName)"></div>
<ul id="log"></ul>
<script>
function log(text) {
var li = document.createElement("li");
li.textContent = text;
document.getElementById("log").appendChild(li);
}
</script>
</body>
</html>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML ontransitionrun event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.

This event attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee