In JavaScript, the scrollsnapchange event fires on a scroll container at the end of a scrolling operation when a new scroll snap target has been selected—just before scrollend (MDN). The event type is a SnapEvent.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for scrollsnapchange. Start with this line.
JavaScript
el.addEventListener("scrollsnapchange", fn)
Call
What it does
el.addEventListener("scrollsnapchange", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("scrollsnapchange", …) — no import required.
Library declarations
JavaScript
el.addEventListener("scrollsnapchange", fn)
Parameters
Parameter
Description
CSS scroll snap
Required. Creates snap targets
Feature detect
Required. Limited / Experimental API
SnapEvent
Required. Selected target element refs
Return Value
Return Value
Description
*
Fires as an Element event (listener receives the Event object).
JavaScript Examples
Example 1 — Feature Detect
Check support before building a snap-change UI.
JavaScript
const supported = "onscrollsnapchange" in window;
console.log(supported);
if (!supported) {
console.log("Use scrollend + nearest-child fallback");
}
Feature-detect first. Avoid attaching on unsupported engines.
Read the target element.snapTargetBlock is an Element reference.
Pull a label. Use data-* or text for a simple message.
Handle null. Inline-only snap containers leave block target as null.
Compatibility
Browser Support
scrollsnapchange is marked Experimental and Limited availability on MDN (not Baseline). Support is incomplete — feature-detect and provide a fallback for browsers without SnapEvent.
✓ Experimental · Limited availability
Element scrollsnapchange
SnapEvent when a new scroll snap target is selected — just before scrollend.
PartialNot Baseline
Google ChromeRecent Chromium (check MDN)
Supported
Mozilla FirefoxOften unavailable
Unavailable
Apple SafariOften unavailable
Unavailable
Microsoft EdgeChromium-based
Supported
OperaChromium-based paths
Partial
Internet ExplorerNot available
Unavailable
scrollsnapchangeLimited
Bottom line: Use progressively: enhance Chromium-class browsers with scrollsnapchange; fall back to scrollend + measuring the nearest snap child elsewhere.
Frequently Asked Questions
It fires on a scroll container at the end of a scrolling operation when a new scroll snap target has been selected—just before the scrollend event (MDN).
MDN marks Element scrollsnapchange as Experimental and Limited availability (not Baseline). It is not Deprecated or Non-standard. Feature-detect before relying on it in production.
A SnapEvent, which inherits from Event. Use snapTargetBlock and/or snapTargetInline to read the newly selected snap targets for each axis.
When the user finishes scrolling in the container—for example after a touch gesture or after dragging the scrollbar—and releases the gesture (MDN).
scrollsnapchanging can fire during a gesture when a pending snap target changes. scrollsnapchange fires once at the end when the new snap target is actually selected.
Set scroll-snap-type on the scroll container and scroll-snap-align on child snap targets so the browser has something to snap to.