[Feat]: Scroll to snap that holds a specific slide #1043
-
SummaryI've been through the methods but unless I missread something it seems we can't actually get the snap point index for any given slide. Let's say I have 15 slides and I want to scroll to the 5th slide (index 4). I can't do It sounds so basic to be able to scroll to a given slide, so am I just missing something? I dig into If applicable, which variants of Embla Carousel are relevant to this question?
Additional informationCodeSandbox exampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @MaxDesignFR, Thanks for your question. I think your suggestion makes sense 👍, so we should add something along these lines: scrollToSlide(subject: number | HTMLElement, jump?: boolean): void {
const index = isNumber(subject) ? subject : slides.indexOf(subject)
const group = slideRegistry.findIndex((group) => group.includes(index))
if (isNumber(group)) scrollTo.index(group, jump)
} |
Beta Was this translation helpful? Give feedback.
-
Hi David! Yes that sounds right. I think this would be a great addition with seemingly little extra code. If this is an additional method and not one to replace the original |
Beta Was this translation helpful? Give feedback.
-
This will be included in |
Beta Was this translation helpful? Give feedback.
This will be included in
v9
: