← Back to blog

The Perfect Slider

Sliders are on of the hardest things to get right in web development. They’re needed in almost every site and nearly every site gets one or two things wrong. It’s been made a lot easier these days with the introduction of scroll snapping, but that still leaves gaps if you want to let users control you’re slider with their mouse on desktops. Test okay

So I thought I would collate my requirements for what makes a good slider, with examples. And at the end I hope to have the the end game slider ready for the world to consume (we will see how we go)

Built in scroll snapping

Scroll snapping has a lot of advantages:

  1. It lets us use the native scrolling engine + momentum controls. Its the best way to get a truly native feeling slider. The slider should use native scrolling wherever possible (horizontal mouse wheels, touch)

  2. It’s also GPU accelerated. Scrolling is performed off the main thread so a busy Javascript app won’t cause your slider to lag

  3. It includes the scrollers momentum when calculating the end snap point - a lot of hand-coded sliders will calculate the end scroll point based on where the user releases the scroller

  4. Hmmm test

Nice