You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a slider with two slides - slide 1 contains a video. I've hooked up some code to remove slide 1 when the video finishes playing, however this could be when you are viewing slide 2. The result of this is nothing showing.
N.B. If the slide in view is slide 1, then slide 2 is shown as expected.
I call slider.removeslide(0) but the slider.currentSlide value increments to 2 (even this should only hit a max of 1 (zero indexed) with 2 slides, let alone 1.
I've tracked this down to this portion of the code in the slider.update method:
// update currentSlide and slider.animatingTo if necessary
if (!carousel) {
if (pos < slider.currentSlide) {
slider.currentSlide += 1;
} else if (pos <= slider.currentSlide && pos !== 0) {
slider.currentSlide -= 1;
}
slider.animatingTo = slider.currentSlide;
}
So if pos is 0, and currentSlide is 1, currentSlide is incremented to 2?
The text was updated successfully, but these errors were encountered:
I've managed to resolve this by replacing the above code with the following:
if (!carousel) {
if (pos <= slider.currentSlide && slider.currentSlide !== 0) {
slider.currentSlide -= 1;
}
slider.animatingTo = slider.currentSlide;
}
I've got a slider with two slides - slide 1 contains a video. I've hooked up some code to remove slide 1 when the video finishes playing, however this could be when you are viewing slide 2. The result of this is nothing showing.
N.B. If the slide in view is slide 1, then slide 2 is shown as expected.
I call slider.removeslide(0) but the slider.currentSlide value increments to 2 (even this should only hit a max of 1 (zero indexed) with 2 slides, let alone 1.
I've tracked this down to this portion of the code in the slider.update method:
// update currentSlide and slider.animatingTo if necessary
if (!carousel) {
if (pos < slider.currentSlide) {
slider.currentSlide += 1;
} else if (pos <= slider.currentSlide && pos !== 0) {
slider.currentSlide -= 1;
}
slider.animatingTo = slider.currentSlide;
}
So if pos is 0, and currentSlide is 1, currentSlide is incremented to 2?
The text was updated successfully, but these errors were encountered: