toutes les images ne sont pas resize 4

This commit is contained in:
Valentin 2024-04-21 18:54:00 +02:00
parent 9dc1b940dc
commit 29437e281a
1 changed files with 5 additions and 7 deletions

View File

@ -70,14 +70,12 @@ function initSwiper() {
}
function resizeVerticalImages() {
setTimeout(() => {
let verticalImages = document.querySelectorAll('.swiper-slide > img');
for (let img of verticalImages) {
console.log(img.clientHeight > img.clientWidth);
let verticalImages = document.querySelectorAll('.swiper-slide > img');
for (let img of verticalImages) {
img.addEventListener('load', () => {
if (img.clientHeight > img.clientWidth) {
console.log("yes");
img.style.width = "50%";
}
}
}, 200);
})
}
}