Рет қаралды 23,310
The scroll-snap property in CSS gives you amazingly smooth and performant scroll snapping for both desktop and mobile browsers. Combine that with element.scrollIntoView() in JS and you have a complete and fully functional carousel that is wonderfully smooth and simple
- Learn more about scroll snap: developer.mozi...
- Browser support: caniuse.com/?s...
- Try it out yourself: jsfiddle.net/L...
- Try a more complex example using JS to programmatically scroll jsfiddle.net/L...