Example 1 — Listen for transitionstart
Log a message when animated values actually begin changing.
const box = document.getElementById("box");
const out = document.getElementById("out");
box.addEventListener("transitionstart", () => {
out.textContent = "transitionstart fired";
}); How It Works
- Pick the element. The node that will animate a CSS property.
- Register the listener.
transitionstartruns when motion begins. - Show feedback. Update status text at the start of the animation.
- Trigger in the lab. Change a transitioned style after setting a non-zero duration.

