Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images to do not lazy load with EffectFade enabled #7281

Closed
5 of 6 tasks
LiamWinterton opened this issue Jan 29, 2024 · 1 comment
Closed
5 of 6 tasks

Images to do not lazy load with EffectFade enabled #7281

LiamWinterton opened this issue Jan 29, 2024 · 1 comment
Labels

Comments

@LiamWinterton
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/devbox/swiper-react-lazy-load-images-forked-t3dd5z?file=%2Fsrc%2FApp.jsx%3A14%2C92

Bug description

With EffectFade enabled, images no longer lazy load.

For larger sliders, this can ruin page speed. As is unfortunately the case for me.

A suggestion for a work around for this was to set non critical slides to visibility: hidden, which for me breaks the functionality of the entire slider.

Expected Behavior

I would expect images to lazy load.

Actual Behavior

Images do not lazy load.

Swiper version

^11.0.5

Platform/Target and Browser Versions

Windows, Chrome

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@nolimits4web
Copy link
Owner

Lazy loading is handling by the browser. You can try to add the following CSS rule for a workaround:

.swiper-slide:not(.swiper-slide-active, .swiper-slide-next, .swiper-slide-prev) img {
      display: none;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants