I need to switch to a specific index. Is this possible?
The method scrollBy only increases the value of the index.
The scrollBy takes a number of slides it should slide to...
If you're on slide 2 - and want to go to slide 3
.scrollBy(1)
If you're on slide 3 - and want to go to slide 2
.scrollBy(-1)
The library really should have a scrollTo(index) method.
@brandoncorbin
That only works if you have 2 slides (You go back and you go next) but how about if you have 6 slides? How exactly to go to the slide you wanted to see?
I have totally no clue on how to do it with many slides. By the way, i use 6 Buttons to manually go to these slides
@Albert0405 the lib requires you to do the math ...
scrollBy(nextSlideIndex - currentSlideIndex)
If user is on slide 2, and you want them to go to slide 6, then the scrollBy will be 4.
6 - 2 = 4
If the user is on slide 6 and you want them to get to slide 2, then the scrollBy would be -4
2 - 6 = -4
@brandoncorbin Can you check my issue please. Regarding with your suggestion above, i dont know how to get the currentSlideIndex
@brandoncorbin
OMG, sorry i already fixed it. It was my mistake for putting currentSlideIndex inside the function, it supposed to be outside it. Thank you for your suggestion 馃憤
Check it here #787
Most helpful comment
The scrollBy takes a number of slides it should slide to...
If you're on slide 2 - and want to go to slide 3
.scrollBy(1)If you're on slide 3 - and want to go to slide 2
.scrollBy(-1)The library really should have a scrollTo(index) method.