In JavaScript, the scroll event fires when an element has been scrolled (MDN). It is a generic Event. Read position from the element with scrollTop / scrollLeft. To detect when scrolling finished, see scrollend.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for scroll. Start with this line.
JavaScript
el.addEventListener("scroll", fn)
Call
What it does
el.addEventListener("scroll", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("scroll", …) — no import required.
Library declarations
JavaScript
el.addEventListener("scroll", fn)
Parameters
Parameter
Description
Scrolling element
Required. Target of the listener
Event
Required. Generic event object
Return Value
Return Value
Description
*
Fires as an Element event (listener receives the Event object).
JavaScript Examples
Example 1 — Listen for scroll
MDN-style listener — note when the element scrolls.
Expect many events. Scroll can fire at a high rate (MDN).
Gate heavy work. Skip scheduling if a timer is already pending.
Update after a short delay.setTimeout batches rapid scrolls.
Keep light feedback optional. A tiny “scrolling…” label can still update immediately.
Compatibility
Browser Support
Elementscroll is Baseline Widely available on MDN (since July 2015). It is a standard event across modern browsers.
✓ Baseline · Widely available
Element scroll
Fires when an element has been scrolled — read scrollTop / scrollLeft on the element.
98%Modern browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
scrollExcellent
Bottom line: Safe for production. Listen on the scrolling element, keep handlers light, and use scrollend when you need the settled end.
Frequently Asked Questions
It fires when an element has been scrolled (MDN). Read the position from the element with scrollTop and scrollLeft. Listen on the element that actually scrolls.
No. MDN marks Element scroll as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A generic Event. There is no special ScrollEvent type here — use the target element’s scroll properties.
No. Element scroll does not bubble, so a parent listener will not see a child’s scroll. Attach the listener to the scrolling element itself.
Scroll can fire at a very high rate. MDN’s examples use setTimeout (or requestAnimationFrame on Document scroll) so expensive work does not run on every single event.
MDN points to the Element scrollend event for detecting when scrolling has completed. Use scroll for continuous updates and scrollend for the final stop.