I'm using the Swiper script to show a slider with a mix of landscape and portrait photos on a site and I was wondering if it's possible to set a specific max height so all images have the same height respecting their aspect ratio. I know that there is a height
parameter on Swiper but I tried it but it doesn't seem to make any difference. Also, I tried to set a max-height
on the .swiper-wrapper
class or the images inside it .swiper-slide > img
but the images are either clipped or distorted.
Any ideas?
Thanks
var swiper = new Swiper( '.swiper-container', {
initialSlide: 0,
loop: true,
autoHeight: true,
height: 200,
autoplay: {
delay: 3000,
disableOnInteraction: false,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});