From 69acab4a9b024af1f164f2388070fec68f906c16 Mon Sep 17 00:00:00 2001 From: rameauv Date: Wed, 7 Jun 2023 18:56:13 +0900 Subject: [PATCH] fix(core): lazyPreloadPrevNext not working with loop mode #6724 (#6726) --- src/shared/process-lazy-preloader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/process-lazy-preloader.js b/src/shared/process-lazy-preloader.js index 4e135c401..68d767005 100644 --- a/src/shared/process-lazy-preloader.js +++ b/src/shared/process-lazy-preloader.js @@ -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 (