-
-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature snap #96
Feature snap #96
Conversation
@rsm0128 is attempting to deploy a commit to the Studio Freight Team on Vercel. A member of the Team first needs to authorize it. |
Hi, thank you for your pull request but unfortunately the timing is not the best 😅. We've just released v1.0.0 which includes major codebase changes. |
👆 This. |
Hey guys, so @rsm0128 was commissioned by me and @funkhaus to do this. I guess we should discuss the desired API for this, to work with what you had in mind for Lenis... It seems to me that Lenis is designed to normalize smooth scrolling across browsers. So given that, we should try to do the same with a ScrollSnap feature (or plugin). Can the Lenis team give us any indication as to when the codebase is in a good state to start this refactor? Sounds liek now would be good? And any help you can provide with how we should build a plugin would be very helpful. Do you have a sample plugin we can see? Or do you want us to build the plugin API too? So therefore I think the concept is to match the CSS Scroll Snap API as much as possible. So the settings that I'd see as applicable and not too difficult to build would be: Container settingsJust the basics of this.
I don't think we need to allow for scroll-padding in this first version. Element settingsSnap-align and snap-stop seem to me to be the bare minimums we need.
I don't think we need Proposed API
Then all required values would be normalized or inferred from the instance settings (easing, duration). For values like LimitationsIn the interests of simplifying things, I propose we limit the scope to just top level snap points. Meaning, we ignore snap elements inside snap elements like this.
Should we focus just on vertical scrolling to begin with? Or is horizontal scrolling also needed? Future roadmapSupport for Nuxt pluginUltimately I want to bring this into Nuxt/Vue, so that would be something to keep in mind as we go. How to get this working across routes in a single page app, or when content loads asynchronously (lazy loading a long scrolling page) in etc... |
@drewbaker @rsm0128 I did a quick draw of how i see the API https://github.com/studio-freight/lenis/blob/main/src/scroll-snap.js |
This is very helpful. So do you guys give me the thumbs up to move forward with this? Does it fit with what you think the use case is for Lenis? And do we think it's stable enough to do it? I suppose as a plugin this can just live in our own repo right? Or do you want to maintain a plugins repo? I'm fine with either. |
@drewbaker Lenis API will not change that much so i think it's ok for you to start building your plugin. Since plugins will not change any lenis internal code, you can create your own repo to match your needs. Althought if something in lenis codebase is blocking you, we will gonna try to fix it for you. In the same time that can be a good try to see how we can standardize lenis plugins |
const clientSize = axis === 'horizontal' ? 'clientWidth' : 'clientHeight'; | ||
|
||
const declaration = parseUnitValue(snapVal) | ||
// get y snap length based on declaration unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Hey @drewbaker is this plugin still in progress or has it been shelved for the time being? No worries if so, just curious. Great addition to the library. Thanks. |
We have a v0 and a v1 version of it over here: https://github.com/rsm0128/lenis-scroll-snap Would love people to use it and log any issues with it, so we can get it fixed. |
That link is 404ing for me, @drewbaker. Would love to try it out and let you know, though. |
Sorry it's set to private, I will get @rsm0128 to make it public ASAP. |
Ok here it is: https://github.com/funkhaus/lenis-scroll-snap please raise an issue for anything you find! |
Awesome, thanks. Would you happen to have a toy codesandbox example or anything lying around? In case you've tried it out in React. If not I'll just figure it out. |
No sorry I haven’t used it on a project yet… |
Thank you for your work, i guess i can close this PR so. I will add you repo into the readme |
Implemented Scroll Snapping by JS (fix #12 )
snap
andsnap-length
Made scrolling stop on mouse down
Added some performance enhancements.