splide
splide copied to clipboard
Lazyload also loads images from sliders out of sight
Checks
- [X] Not a duplicate.
- [X] Not a question, feature request, or anything other than a bug report directly related to Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions
Version
v4.0.6
Description
When using lazyload for the sliders, it also loads the images from a slider that's not in the viewport or nearby. Like if I'm opening a new page and the slider is a the very end of the page, it still loads the images, which isn't necessary. I also can't use another lazyload, because the slides aren't "display: none", so any other lazyloading will load all images from that slider at once instead of reloading them while sliding.
Reproduction Link
No response
Steps to Reproduce
- Mount a Splide with "lazyload: 'nearby'"
- Have an image with data-splide-lazy and/or data-splide-lazy-srcset at the very end of the page or out of viewport.
- Look at the network tab that the image still gets loaded.
Expected Behaviour
Load the image as the slider or slide gets in view or with a threshold by some pixels.