Skip to content

Commit

Permalink
feat(virtual): support rewind functionality with Virtual slides
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 31, 2022
1 parent 80958d5 commit e52de28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/slide/slidePrev.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export default function slidePrev(speed = this.params.speed, runCallbacks = true
}
}
if (params.rewind && swiper.isBeginning) {
return swiper.slideTo(swiper.slides.length - 1, speed, runCallbacks, internal);
const lastIndex =
swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual
? swiper.virtual.slides.length - 1
: swiper.slides.length - 1;
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
}
return swiper.slideTo(prevIndex, speed, runCallbacks, internal);
}

0 comments on commit e52de28

Please sign in to comment.