Skip to content

Commit

Permalink
fix(virtual): fix last slide index check in virtual slides
Browse files Browse the repository at this point in the history
fixes #6595
  • Loading branch information
nolimits4web committed Apr 21, 2023
1 parent 035e79d commit 154f048
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ class Swiper {
swiper.isEnd &&
!swiper.params.centeredSlides
) {
translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
const slides =
swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
translated = swiper.slideTo(slides.length - 1, 0, false, true);
} else {
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
}
Expand Down

0 comments on commit 154f048

Please sign in to comment.