You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initial slide at index 0
lazyPreloadPrevNext > 0
loop = true
After the swiper has finish initializing, the current slide and 2 slides prior to it (since the initial slide index is 0 and the loop mode is enabled, the last 2 slides) should not have loading=lazy, due to lazyPreloadPrevNext:2.
The same code with probably if (realIndex <= activeIndex || realIndex > slideIndexLastInView) instead of if (realIndex !== activeIndex && realIndex > slideIndexLastInView) in case the initial slide index is not 0 should do the trick.
Check that this is really a bug
Reproduction link
https://codesandbox.io/p/sandbox/swiper-lazy-load-images-forked-9kxr8y?file=%2Findex.html%3A69%2C76-69%2C80
Bug description
Preconditions:
Initial slide at index 0
lazyPreloadPrevNext > 0
loop = true
After the swiper has finish initializing, the current slide and 2 slides prior to it (since the initial slide index is 0 and the loop mode is enabled, the last 2 slides) should not have loading=lazy, due to lazyPreloadPrevNext:2.
The same code with probably
if (realIndex <= activeIndex || realIndex > slideIndexLastInView)
instead ofif (realIndex !== activeIndex && realIndex > slideIndexLastInView)
in case the initial slide index is not 0 should do the trick.swiper/src/shared/process-lazy-preloader.js
Lines 29 to 34 in a8fc1df
Expected Behavior
The last 2 image should have loading=lazy removed.
Actual Behavior
The last 2 image still have loading=lazy.
Swiper version
9.3.2
Platform/Target and Browser Versions
macOS 13.0.1 (22A400) intel, chrome 113.0.5672.77 (Official Build) (x86_x64)
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: