Swiper lazy-loading behavior with preloadImages false and external libraries
0 reputation · 28 Dec 2020, 03:35 UTC
When configuring Swiper for a low‑traffic site, the goal is to reduce bandwidth by deferring image loading until slides become visible. The documented lazy‑loading plugin supports lazy: { loadPrevNext: true } and, when combined with preloadImages: false, should prevent any images from being fetched before they are needed.
In many projects, a third‑party image lazy‑load library (e.g., lazysizes) is also applied to the same img elements. The concern is that Swiper’s lazy‑loading may still trigger a fetch for an image that the external library has already queued, leading to duplicate network requests and wasted bandwidth.
To clarify this interaction, we need to understand whether Swiper’s lazy‑loading respects the preloadImages: false flag when a third‑party lazy‑load script is active, and how to configure both tools to avoid double‑loading.
1. Does Swiper’s lazy‑loading plugin honor preloadImages: false when a third‑party image lazy‑load library is also attached to the same img tags?
2. If not, what configuration or ordering of initialization ensures that only one lazy‑load mechanism triggers the network request?
3. Are there known Swiper versions where this interaction is documented or fixed?