The Document scrollsnapchanging event fires when the browser decides a new scroll snap target is pending (it will be selected when the current gesture ends). Learn CSS setup on html, the MDN pending class pattern, and five try-it labs.
01
Kind
Document event
02
Type
SnapEvent
03
Means
Pending snap target
04
Needs
scroll-snap-type on html
05
Key prop
snapTargetBlock
06
Status
Experimental
Fundamentals
Introduction
While the user is mid-gesture, the browser may already know which section will snap when they let go. That upcoming choice is a pending snap target—and that is when Document scrollsnapchanging fires.
Pair it with scrollsnapchange for the final selection after the scrolling operation ends. Both use SnapEvent.
💡
Beginner tip
For Document scrollsnapchanging, set scroll-snap-type on html (MDN). If snap lives on a scrolling <div>, use Element scrollsnapchanging instead.
Concept
Understanding Document scrollsnapchanging
A Document event that answers: “Is a new snap target pending for when this gesture ends?”
Fires when the browser determines a new scroll snap target is pending (MDN).
Pending means it will be selected when the current scroll gesture ends.
Requires the HTML document as snap container (scroll-snap-type on html).
Event type — SnapEvent (inherits from Event).
Handler — document.onscrollsnapchanging or addEventListener("scrollsnapchanging", ...).
Status — Experimental and Limited availability on MDN (not Baseline).
Foundation
📝 Syntax
Use the event name with addEventListener, or set the handler property:
Four facts to remember about Document scrollsnapchanging.
Event type
SnapEvent
Has snap targets
Means
Pending
Will snap next
CSS
on html
scroll-snap-type
Status
Experimental
Not Baseline
Hands-On
Examples Gallery
Examples follow MDN Document: scrollsnapchanging event. Labs use document-level CSS snap. Support is limited—feature-detect and scroll mid-gesture to see pending targets.
📚 Getting Started
MDN pending-class pattern and the handler property.
Example 1 — Add pending Class (MDN)
Clear old pending marks, then highlight event.snapTargetBlock.
Document scrollsnapchanging is marked Experimental and Limited availability on MDN (not Baseline). Logos use the shared browser-image-sprite.png sprite from this project. Feature-detect and keep CSS snap usable without the event.
✓ Experimental · Limited availability
Document scrollsnapchanging
Fires when a new scroll snap target is pending (will be selected when the gesture ends).
LimitedCheck compat
Google ChromeCheck BCD / Chromium scroll snap events
Partial
Mozilla FirefoxLimited / check BCD
Limited
Apple SafariLimited / check BCD
Limited
Microsoft EdgeFollow Chromium (check BCD)
Partial
OperaFollow Chromium behavior
Partial
Internet ExplorerNo scrollsnapchanging
Not supported
scrollsnapchangingLimited availability
Bottom line: Set scroll-snap-type on html, listen for scrollsnapchanging, style event.snapTargetBlock as pending, and pair with scrollsnapchange.
Wrap Up
Conclusion
Document scrollsnapchanging previews the pending snap target during a gesture. Pair it with scrollsnapchange for the final selection. Keep CSS snap as the core UX.
Five things to remember about Document scrollsnapchanging
Pending snap target — will be selected when the gesture ends.
5
Core concepts
📄01
Pending
during gesture
Event
🎨02
SnapEvent
snapTargetBlock
API
💻03
CSS on html
scroll-snap-type
Setup
🔍04
Detect
before relying
Compat
⚠️05
Experimental
not Baseline
MDN
❓ Frequently Asked Questions
It fires on the scroll container when the browser determines a new scroll snap target is pending — it will be selected when the current scroll gesture ends. The Document must be the snap container (scroll-snap-type on html).
MDN marks Document scrollsnapchanging as Experimental and Limited availability (not Baseline). It is not Deprecated or Non-standard. Feature-detect before production use.
scrollsnapchanging means a snap target is pending during the gesture. scrollsnapchange means a new snap target was selected at the end of the scrolling operation. Pending first, then selected.
A SnapEvent, which inherits from Event. Use event.snapTargetBlock (and snapTargetInline when relevant) for the pending snap target element.
MDN’s example removes old pending classes, then adds pending to event.snapTargetBlock so only the current pending target is highlighted.
Same idea for an Element snap container. Document scrollsnapchanging is for when html is the scroll snap container.
Did you know?
Scroll snap itself is mostly CSS. Events like scrollsnapchanging exist so scripts can preview the upcoming snap target during a gesture—without guessing from raw scrollY math.