Skip to content

Commit

Permalink
fix(lazyPreloadPrevNext): lazyPreloadPrevNext not working with loop m…
Browse files Browse the repository at this point in the history
  • Loading branch information
rameauv committed Jun 4, 2023
1 parent 609257c commit 1405400
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 1405400

Please sign in to comment.