Closed simon-mundy closed 3 years ago
Hi Simon (@simon-mundy),
Thank you for your feature request.
There are situations where I would like to create a Carousel in a modal overlay and jump to a specific slide rather than scrolling/animating to it.
Have you tried using the startIndex option? Usage looks like this:
const embla = EmblaCarousel(emblaNode, { startIndex: 2 })
const embla = useEmblaCarousel({ startIndex: 2 })
You can also make use of the reInit method like so:
embla.reInit({ startIndex: 2 })
If we're to add this feature to the Embla core, I think we need to add it to the following methods:
One way to do it would be to add a boolean
as a second argument that triggers an instant
scroll. The default value for this will be false
:
embla.scrollTo(2, true) // Scrolls instantly
Let me know what you think.
Best, David
Hello Simon (@simon-mundy),
I've been wanting to add this feature to Embla Carousel myself so I just added it and released v4.4.0, which has this feature. Please try it out and let me know if it's working as intended.
Best, David
Amazing! Thankyou @davidcetinkaya will give it a try ASAP
Great @simon-mundy. Let me know if it’s working as intended.
@simon-mundy closing this as resolved. Feel free to open it if you run into any issues.
Best, David
Feature request is related to
Is your feature request related to an issue?
Describe the solution you'd like
jumpTo
orselect
) be added to allow a non-animated jump to a specific slide.