event

Scrollend — CSS reference

The scrollend event indicates completion of scrolling, including completed smooth scrolling or gesture-driven updates. If no position changes, no event is required. Feature-detect it and use scroll for continuous progress; a timer fallback is only an approximation of completion. The button moves the scroll position using an instant operation.

Formal Syntax & Structure

css syntaxcss
element.addEventListener("scrollend", handler);

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>scrollend</title><style>body{margin:8px;font:16px/1.5 sans-serif}*{box-sizing:border-box}#a{height:80px;width:180px;overflow:auto}#b{height:300px}</style><body><button id="go">Scroll down</button><div id="a" tabindex="0" aria-label="Scrollable sample"><div id="b">Scroll area</div></div><output id="status" aria-live="polite"></output><script>const sc=document.getElementById("a");sc.addEventListener("scrollend",()=>document.getElementById("status").textContent="Scroll complete");document.getElementById("go").onclick=()=>sc.scrollTo({top:100,behavior:"instant"});</script></body></html>
CSS Reference