Skip to content

Commit c946018

Browse files
preload lint fixes
1 parent 6d08635 commit c946018

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/shared/process-lazy-preloader.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ export const processLazyPreloader = (swiper, imageEl) => {
99
};
1010

1111
const unlazy = (swiper, index) => {
12-
const imageEl = swiper.slides[i].querySelector('loading="lazy"');
12+
const imageEl = swiper.slides[index].querySelector('loading="lazy"');
1313
if (imageEl) imageEl.removeAttribute('loading');
1414
};
1515

1616
export const preload = (swiper) => {
1717
if (!swiper || swiper.destroyed || !swiper.params) return;
18-
var amount = swiper.params.lazyPreloadPrevNext;
18+
let amount = swiper.params.lazyPreloadPrevNext;
1919
const len = swiper.slides.length;
2020
if (!len || !amount || amount < 0) return;
2121
amount = Math.min(amount, len);
2222
const active = swiper.activeSlide;
2323
if (swiper.params.rewind) {
24-
for (var i = active - amount; i <= active + amount; i++) {
24+
for (let i = active - amount; i <= active + amount; i += 1) {
2525
const reali = ((i % len) + len) % len;
26-
if (reali != active) unlazy(swiper, reali);
26+
if (reali !== active) unlazy(swiper, reali);
2727
}
2828
} else {
29-
for (var i = Math.max(active - amount, 0); i <= Math.min(active + amount, len - 1); i++) {
30-
if (i != active) unlazy(swiper, i);
29+
for (let i = Math.max(active - amount, 0); i <= Math.min(active + amount, len - 1); i += 1) {
30+
if (i !== active) unlazy(swiper, i);
3131
}
3232
}
3333
};

0 commit comments

Comments
 (0)