more JS 💀

This commit is contained in:
Michał Gdula 2023-04-19 18:04:32 +00:00
parent 0cc5f70e4f
commit 9e788b0cec
3 changed files with 10 additions and 11 deletions

View file

@ -9,7 +9,7 @@ function loadOnView() {
const webpSupport = checkWebpSupport();
for (let i = 0; i < lazyLoad.length; i++) {
let image = lazyLoad[i];
const image = lazyLoad[i];
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
if (!image.src && webpSupport) {
image.src = `${image.getAttribute('data-src')}&e=webp`;