lenis icon indicating copy to clipboard operation
lenis copied to clipboard

Scroll Snapping not working

Open Rosinida opened this issue 2 years ago • 18 comments

Hi, i tried to add scroll-snapping to my HTML and it worked! But sadly there is an issue while using scroll-snap-align: start; It always jumps without animation to my next section. https://css-tricks.com/practical-css-scroll-snapping/#aa-example-3-vertical-full-screen

Can you fix that?

(Love your code!) Thanks Robin

Rosinida avatar Aug 28 '22 16:08 Rosinida

Hi @Rosinida thank you for your feedback, can you provide a live demo (ideally on codepen or codesandbox) ?

clementroche avatar Aug 28 '22 16:08 clementroche

Hi @clementroche sure, just made a very simple codepen demo for you. – hope this helps! https://codepen.io/rosinida/pen/BargMXG Thanks Robin

Rosinida avatar Aug 29 '22 08:08 Rosinida

Hi @clementroche. Is there a workaround to define a minimum scroll distance? (as long as the scroll snapping doesn't work yet)

Rosinida avatar Sep 06 '22 08:09 Rosinida

What do you mean by minimum scroll distance ? You mean emulate CSS scroll snap ?

clementroche avatar Sep 06 '22 08:09 clementroche

Yes. I would like to say: Each scroll should get the same scroll distance (for example 100vh)

Rosinida avatar Sep 06 '22 11:09 Rosinida

Any update on this? I'm facing the same issue - Lenis smooth scroll and CSS snap scroll doesn't work together very well.

harshilsharma63 avatar Sep 20 '22 13:09 harshilsharma63

It seems like the solution would be to emulate scroll snapping using JavaScript and that's something we want to avoid. So for the moment i would advice you to not use Lenis if you need CSS snap scroll.

clementroche avatar Sep 29 '22 09:09 clementroche

Thanks for the update.

harshilsharma63 avatar Sep 30 '22 07:09 harshilsharma63

Investigating: setting the wrapper and the content it will scroll but not interpolating with css easing of the snap. I think this could be a neverending issue.

EDIT: Solving this to me is like solving and improving accessibility of those king of scroll hijacking where you have to wait before triggering another scroll. what a dream :D

liqueflies avatar Nov 04 '22 14:11 liqueflies

It seems like the solution would be to emulate scroll snapping using JavaScript and that's something we want to avoid. So for the moment i would advice you to not use Lenis if you need CSS snap scroll.

So stoked to see this library... Really like the approach. Scroll Snap is certainly something we need a lot. Would you be open to a PR trying to implement this? Or is this just a "hard no" that you don't want us to even try?

drewbaker avatar Dec 17 '22 03:12 drewbaker

Of course we're open to a PR !

clementroche avatar Dec 17 '22 12:12 clementroche

Noting a possible solution to consider https://github.com/ocsal/scroll-snap

drewbaker avatar Jan 11 '23 23:01 drewbaker

Hi @drewbaker, Here is a PR for scroll snapping. It emulates scroll snapping by using JavaScript.

rsm0128 avatar Jan 14 '23 17:01 rsm0128

Hey you can try https://github.com/funkhaus/lenis-scroll-snap

clementroche avatar Apr 18 '23 11:04 clementroche

Hey you can try https://github.com/funkhaus/lenis-scroll-snap

Is this available for react wrapper. if so how do we use it? Thank you so much.

sushanyadav avatar Apr 18 '23 15:04 sushanyadav

it should, react-lenis gives you the lenis instance as ref or using useLenis so you just need to plug it then.

clementroche avatar Apr 18 '23 15:04 clementroche

It would be greatly appreciated if somebody could include a sandbox for this. 🙏

sushanyadav avatar Apr 18 '23 16:04 sushanyadav

hey @Rosinida you can try lenis/snap

clementroche avatar Jun 27 '24 09:06 clementroche