01.10 · Scroll-Based
Snap Scrolling
The box settles on one whole section at a time. Best for slides and galleries.
Scroll it
Scroll inside the box and let go: it settles on the nearest section. Press Play and it glides through without snapping.
A stop lines up here
Past a dashed line, it settles on the next
Always snaps
Inside, solid lines mark where the box can stop, each section's top, and past a dashed middle line it settles on the next one. Scroll the box a little and let go.
No snapping rests wherever you let go; Always snaps settles on the nearest whole section. Scroll either box a little and let go.
Try it
Change a setting, then scroll again or press Play.
Snapping
Scroll by hand to see it; Play glides without snapping.
Copy the prompt
Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.
Add snap scrolling to [your page of full-height sections, slides or gallery]. Make each section exactly as tall as the scrolling area and mark its top as a snap point, so that, as the settings choose, the view settles on the nearest section instead of stopping between two. Use the browser's built-in scroll snapping rather than a script. Add small dots that show which section is in view and take the visitor to a section when pressed. Check scrolling with the arrow keys too, because strict snapping can feel stiff there. If the visitor has reduced motion turned on, let the view settle without a smooth glide. Match the settings listed below.
Your settings
Replace the words in brackets with your own element. Your settings are added at the end.
Free and open source. If this helped, a star on GitHub helps other people find it.
Star on GitHubWhat it is
The full explanation is in README.md.