el.addEventListener("transitionrun", () => {
console.log(
"Transition is running but hasn't necessarily started transitioning yet",
);
});Element: transitionrun event / notebook
Element: transitionrun event
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
el.ontransitionrun = () => {
console.log(
"Transition started running, and will start transitioning when the transition delay has expired",
);
};<div class="transition">Hover over me</div>
<div class="message"></div>.transition {
width: 100px;
height: 100px;
background: red;
transition-property: transform, background;
transition-duration: 2s;
transition-delay: 1s;
}
.transition:hover {
transform: rotate(90deg);
background: transparent;
}const el = document.querySelector(".transition");
const message = document.querySelector(".message");
el.addEventListener("transitionrun", () => {
message.textContent = "transitionrun fired";
});
el.addEventListener("transitionstart", () => {
message.textContent = "transitionstart fired";
});
el.addEventListener("transitionend", () => {
message.textContent = "transitionend fired";
});