Example 1 — Listen for transitionrun
Log a message as soon as a CSS transition is created.
const box = document.getElementById("box");
const out = document.getElementById("out");
box.addEventListener("transitionrun", () => {
out.textContent = "transitionrun fired";
}); How It Works
- Pick the element. The node that will get a CSS transition.
- Register the listener.
transitionrunruns when the transition is created. - Show feedback. Update status text as soon as the transition is scheduled.
- Trigger in the lab. Change a transitioned style (for example opacity) after setting a non-zero duration.

