Skip to content

Commit

Permalink
fix(core): fix lazy preloader in later initialized slides
Browse files Browse the repository at this point in the history
fixes #6946
  • Loading branch information
nolimits4web committed Aug 30, 2023
1 parent 12a44fb commit e4fddc0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/shared/process-lazy-preloader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ export const processLazyPreloader = (swiper, imageEl) => {
if (slideEl) {
let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);
if (!lazyEl && swiper.isElement) {
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
if (slideEl.shadowRoot) {
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
} else {
// init later
requestAnimationFrame(() => {
if (slideEl.shadowRoot) {
lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);
if (lazyEl) lazyEl.remove();
}
});
}
}
if (lazyEl) lazyEl.remove();
}
Expand Down

0 comments on commit e4fddc0

Please sign in to comment.