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
When designing carousels, designers often like to show part's of the next slide to give the user a hint, that there is more content to explore. This can be done with swiper by setting the option slidesPerView to e.g. 3.5 as value, which will correctly show 50% of the 4th slide.
So far so good. When taking image lazy loading options into the game (and specifically the option loadPrevNext), a fractional value for slidesPerView seems to break the logic for preloading the previous / next image. You can see that behaviour in the codesandbox. As soon as you change the value for slidesPerView to a full number like 3, preloading the previous / next image works again.
Expected Behavior
When defining a fractional Number for slidesPerView, I expect the next currently fully hidden image to be preloaded.
E.g. slidesPerView set to 3.5. The 5th image is lazy loaded on init and already loaded when I swipe the first time.
Actual Behavior
When defining a fractional Number for slidesPerView, The next currently fully hidden image is only loading when swiping the first time.
E.g. slidesPerView set to 3.5. The 5th image is only loading after I swiped the first time.
Reproduction link
https://codesandbox.io/s/swiper-lazy-load-images-forked-1sd1zz
Bug description
When designing carousels, designers often like to show part's of the next slide to give the user a hint, that there is more content to explore. This can be done with swiper by setting the option
slidesPerView
to e.g.3.5
as value, which will correctly show 50% of the 4th slide.So far so good. When taking image lazy loading options into the game (and specifically the option
loadPrevNext
), a fractional value forslidesPerView
seems to break the logic for preloading the previous / next image. You can see that behaviour in the codesandbox. As soon as you change the value forslidesPerView
to a full number like 3, preloading the previous / next image works again.Expected Behavior
When defining a fractional Number for
slidesPerView
, I expect the next currently fully hidden image to be preloaded.E.g.
slidesPerView
set to 3.5. The 5th image is lazy loaded on init and already loaded when I swipe the first time.Actual Behavior
When defining a fractional Number for
slidesPerView
, The next currently fully hidden image is only loading when swiping the first time.E.g.
slidesPerView
set to 3.5. The 5th image is only loading after I swiped the first time.Swiper version
8.1.4
Platform/Target and Browser Versions
macOs Chrome 101
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: