I want a Scroll Snap API

Submitted by Christian "Schepp" Schaefer

Currently, when I use CSS Scroll Snap Points, there are a few shortcomings which I'd like to see addressed. They all center around programmatically interacting with them:

  1. I'd love to have .start(), .previous(snapCount), .next(snapCount), and .end() methods to move them around (e.g., when people click on arrow buttons, tap an arrow key on their keyboard, or when having it auto-slide forward).
  2. I'd like to have a snap event, once the element has snapped to a point, with info on which snap point of how many total snap points it just snapped to, so that I can update a progress indicator.
  3. I'd like to see the scroll event getting a new property which tells me if a scroll event was user-created or if it results from automatic scrolling (also interesting for the smooth scrolling coming from CSS scroll-behavior).
  4. I'd love to see the problem of endless scrolling carousels solved somehow, maybe by something similar to what CSS -moz-element does, to be able to have a carousel/scroll snap element repeat its elements whenever its end has been reached.
Tagged
JavaScript CSS