if youve ever wished to make scroll animations on social media platforms smoother without relying heavily on javascript-heavy libraries like gsap,problem:
scrolling effects often feel janky or slow, especially with large images and videos.
solution :
use a css property called ''scroll-snap-type. its supported by all modern browsers (and even some older ones)!
body {scroll-behavior: smooth;}section {height:100vh;}/'' Add this ''/. body-sections {--snap-offset:-3rem;&::before{content:";position:absolute;top:${var(--scroll-y)};left:auto;width:$screen-width + ${2 * var(--snap-amount)}px;height:10vh; /'' Adjust based on your need /background-color:white! important ;}}this creates a subtle scroll effect that feels much smoother and faster. you can tweak the values to get exactly what you want.
>Imagine scrolling through Instagram stories, feeling like it's buttery smoothscroll-snap-type just makes sure your content snaps into place beautifully without adding extra load on page performance.
old school methods of using settimeout for scroll events were clunky and unreliable. this is a much cleaner approach!~