splide icon indicating copy to clipboard operation
splide copied to clipboard

Lazyload also loads images from sliders out of sight

Open scarlachs opened this issue 3 years ago • 0 comments

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

  1. Mount a Splide with "lazyload: 'nearby'"
  2. Have an image with data-splide-lazy and/or data-splide-lazy-srcset at the very end of the page or out of viewport.
  3. 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.

scarlachs avatar Jun 30 '22 19:06 scarlachs