-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Percentage alignment options #49
Comments
Curious to learn more about how Embla works under the hood, I took a quick pass at this on my |
Hello Nik (@nikrowell), I'm happy you like the Embla Carousel initiative 🙂. And thank you for your feature request. The answer to your question is yes, I've considered adding percentage to the align option. I appreciate your contribution, it's definitively a good starting point! It requires additional refactoring in order for it to work properly though. The main part that needs attention is the logic that determines which scroll snap is selected depending on the scroll position, which is located in the scrollTarget component. This is how Embla works today 👇 Depending on the chosen alignment, Embla checks which scroll snap has the alignment line (the red one on the screenshot) within its left and right bound (the green lines on the screenshot). On the screenshot, you can see that scroll snap number I'm afraid that the current implementation only works for The vision is the following 👇 Where we only need to compare the center of each scroll snap in order to determine which one is closest to the alignment line. This will work as intended whether the chosen alignment is At the time of writing I have a huge backlog including everything from a lot of feature requests to writing documentation (like finishing the event section, see issue #45) and setting up CodeSandbox demonstrations etc. Unfortunately, I rarely get any contributions on any of these tasks, so things are progressing slow. With that said, I'm hoping to be able to investigate this soon, but can't give you an estimate on when this will happen. I hope you understand! I took the liberty to change the issue title to a more specific one, I hope you don't mind. Best, |
Hi David, Thank you for the feedback and detailed explanation - very helpful! I hadn't thought about the impact of this on logic for selected states, I completely understand on the backlog and would be happy to contribute to those tasks as well. I'll take a look and see where I can help. Cheers! |
Hello Nik (@nikrowell), An update on this feature request 👇 I just wanted to let you know that I'm working on refactoring the Kindly |
Hello again Nik (@nikrowell), I'm happy to announce that I actually managed to reduce the bundle size when I refactored I'd very much appreciate if you could confirm if this feature is working as expected. Cheers! |
Thank you, David (@davidcetinkaya)! 🎉 I tested things out and it's working as expected on my end - love that it also reduced the bundle size! |
I'm happy to hear that Nik (@nikrowell), enjoy 😊! |
Hi @davidcetinkaya - thanks for your work on this - love your vision for a lightweight and flexible carousel!
I'm working on a project where it would be useful to specify the
align
option as a percentage from the left edge (let me know if helpful to have a visual / example of my use case). Is this something you could see being added to Embla?The text was updated successfully, but these errors were encountered: