Lazy load image on Slider Move #6241
derWebdesigner
started this conversation in
Ideas
Replies: 3 comments 2 replies
-
I did something like this: const transitionEndEvent = (event) => {
// remove loading lazy
const els = document.getElementsByClassName("swiper-slide-next")
if (els.length > 0) {
const imgEls = els[0].getElementsByTagName("img")
for (const imgEl of imgEls) {
imgEl.setAttribute("loading", "eager")
}
}
} Edit: It looks like it doesn't work well for now. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm facing the same issue and I'm curious about the solution. |
Beta Was this translation helpful? Give feedback.
1 reply
-
It is strange when the most popular package was released 10 years ago but has not addressed this problem yet. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear community,
I just implemented lazy loading for my image slider and I was wondering if there is an option to load the next image a bit earlier than loadOnTransitionStart because this results in the effect that I can drag the slide to the side and the image won't be loaded until I release the drag state.
The Airbnb app is a great reference where the image gets loaded as soon as the next slide is a few pixels in the viewport, no matter if I still drag the slider or not. This is extremely efficient because I don't load the next image immediately without needing it and it feels super fast and responsive.
Or is there maybe a way already to implement that myself by manually firing the lazy loading for the next slide when the slide becomes visible?
Thank you very much in advance,
Manuel
Beta Was this translation helpful? Give feedback.
All reactions