Skip to content

Commit

Permalink
fix(core): lazyPreloadPrevNext not working with loop mode #6724 (#6726)
Browse files Browse the repository at this point in the history
  • Loading branch information
rameauv committed Jun 7, 2023
1 parent 36ef2e6 commit 69acab4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shared/process-lazy-preloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export const preload = (swiper) => {
: Math.ceil(swiper.params.slidesPerView);
const activeIndex = swiper.activeIndex;
const slideIndexLastInView = activeIndex + slidesPerView - 1;
if (swiper.params.rewind) {
if (swiper.params.rewind || swiper.params.loop) {
for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {
const realIndex = ((i % len) + len) % len;
if (realIndex !== activeIndex && realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);
}
} else {
for (
Expand Down

0 comments on commit 69acab4

Please sign in to comment.