[Help]: Change snap points when using scrollTo method #873
Replies: 1 comment 3 replies
-
Hi @AndrewPJohnson, I'm a bit confused. What should happen when you click on a slide? Should the carousel scroll to the snap point that slide belongs to? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I have a horizontal calendar carousel I just built using embla. When a user clicks on a calendar item I scroll it to the start of the carousel. The only way I can get that to work is by enabling dragFree. The problem is I like the animation when slidesToScroll is set to auto and dragFree is disabled (looks better in mobile browsers). When I set that to auto, the scrollTo method doesn't work like it does when dragFree is enabled. It scrolls to the nearest snap point using the number of slides to scroll instead of scrolling right to the clicked item.
I added a few examples in the CodeSandbox of what is happening to clear confusion.
So is there a way to accomplish sliding an item to the start while also using slidesToScroll set to auto? My thoughts are disabling slidesToScroll and then enabling it after the scroll finishes. Or somehow changing the snap points.
If applicable, which variants of Embla Carousel are relevant to this question?
Additional information
No response
CodeSandbox example
CodeSandbox
Beta Was this translation helpful? Give feedback.
All reactions