Add Scroll Snap with CSS

Add Scroll Snap with CSS

Coding in Public

2 года назад

2,736 Просмотров

While people scroll your webpage, you can help snap them to important sections with the scroll-snap-type property on a parent and the scroll-snap-align property on the children. I’ll show you how to get scroll snapping to work both on the X and Y axis, how to disable scroll snap for those with prefers-reduced-motion, and how to padding padding to your scroll behavior.

🔗 Key Links 🔗
- Scroll snap MDN docs: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type
- CSS Tricks article: https://css-tricks.com/practical-css-scroll-snapping/
- Conic.style: https://www.conic.style/
---------------------------------------

🔗 Additional Links 🔗
- Live server for VSCode: https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer

---------------------------------------

📹 Related/Mentioned Videos 📹
- Emmet for HTML: https://www.youtube.com/watch?v=AGAXv3GjH60

---------------------------------------

⏲️ Timestamps ⏲️
0:00 Introduction
0:30 Setting up the project
2:40 Adding scroll snap

---------------------------------------

🌐 Connect With Me 🌐
- Website: https://www.codinginpublic.dev
- Blog: https://www.chrispennington.blog
- Twitter: https://twitter.com/cpenned
Ссылки и html тэги не поддерживаются


Комментарии:

@thechoosen4240
@thechoosen4240 - 22.10.2022 21:56

Good job bro, JESUS IS COMING BACK VERY SOON;PREPARE

Ответить
@neontuts5637
@neontuts5637 - 21.11.2021 05:04

Nice scroll effect. When the parent's scroll-snap-type is y mandatory, we can jump to each section one by one using the up & down arrow key. Thanks for sharing :)

Ответить