猫头鹰旋转木马垂直和水平,高度相同

时间:2016-04-07 21:26:48

标签: javascript jquery html css owl-carousel

我正在尝试制作带有垂直和水平图像的猫头鹰旋转木马的旋转木马,我希望两种类型的图像和宽度自动具有相同的高度。 我不明白我是否只能用css实现这一点,或者我需要使用js来更新每个图像的高度

这是我的codepen http://codepen.io/mp1985/pen/LNejmO

$('.owl-carousel').owlCarousel({
    loop:true,
    nav:true,
    responsive:{
        0:{
            items:1
        },
        800:{
            items:3
        },
        1000:{
            items:3
        }
    }
});

任何帮助或建议?

1 个答案:

答案 0 :(得分:1)

如果使用CSS

在图像上设置最大高度
.owl-carousel .item img{
  max-height:600px;
}

并更新JS函数以包含

autoWidth:true,

这应该有效

请在此处查看演示 http://www.owlcarousel.owlgraphic.com/demos/autowidth.html

相关问题