toutes les images ne sont pas resize 2

This commit is contained in:
Valentin 2024-04-21 18:48:08 +02:00
parent 25a022ea48
commit 44301d5fd4
1 changed files with 8 additions and 13 deletions

View File

@ -21,9 +21,7 @@ $(document).ready(function() {
let swiperEl = document.querySelector('.swiper');
if (swiperEl) {
swiperEl.style.opacity = 1;
setTimeout(() => {
resizeVerticalImages();
}, 100);
}
initSwiper();
barba.init({
@ -57,11 +55,8 @@ $(document).ready(function() {
} else {
body.style.overflowY = "auto";
}
setTimeout(() => {
resizeVerticalImages();
}, 100);
});
})
function initSwiper() {
@ -75,12 +70,12 @@ function initSwiper() {
}
function resizeVerticalImages() {
if (document.querySelector('.swiper')) {
let verticalImages = document.querySelectorAll('.swiper-slide > img');
for (let img of verticalImages) {
console.log(img.clientHeight > img.clientWidth);
if (img.clientHeight > img.clientWidth) {
console.log("yes");
img.style.width = "50%";
}
}
}
}