flickity icon indicating copy to clipboard operation
flickity copied to clipboard

lazyLoad loading too many images

Open patricekaufmann opened this issue 2 years ago • 3 comments

The issue originates from RR https://github.com/metafizzy/flickity/pull/158

While this is more than 7 years ago, this change actually leads to weird behaviour in the following scenario:

Settings: 100% slide width, lazyLoad: 1 and wrapAround: false Slide Amount: 3

I would expect to always only lazyload the next element in this case, however with that change in the PR it leads to preloading all images if there are 3 slides total since 1 + (1 * 2) >= 3.

patricekaufmann avatar Aug 19 '22 01:08 patricekaufmann

I'm not seeing 3 slides loaded in this example. Could you provide a test case showing the bug?

desandro avatar Jan 16 '23 01:01 desandro

Thanks for looking into this! I modified your example by removing the fourth item. The bug happens when there are exactly three items:

https://codepen.io/patricekaufmann/pen/XWBaBKj

Network tab showing 3 images loaded on page load:

msedge_HHUqdEuhPz

patricekaufmann avatar Jan 16 '23 09:01 patricekaufmann

aaaaah good catch. Thanks for that. I'll have a fix in the next release!

desandro avatar Jan 18 '23 01:01 desandro