我一直在努力让我的内容垂直对齐,但真的没有修复它。我尝试了adaptiveHeight 参数,但它确实没有达到我想要的效果。
小提琴:http: //jsfiddle.net/fmo50w7n/400
这就是代码看起来像 HTML 的样子:
<section class="slider">
<div style="width:500px;height:200px">slide1</div>
<div style="width:500px;height:300px;">slide2</div>
<div style="width:500px;height:100px;">slide3</div>
</section>
CSS:
$c1: #3a8999;
$c2: #e84a69;
.slider {
width: auto;
margin: 30px 50px 50px;
}
.slick-slide {
background: $c1;
color: white;
padding: 40px 0;
font-size: 30px;
font-family: "Arial", "Helvetica";
text-align: center;
}
.slick-prev:before,
.slick-next:before {
color: black;
}
.slick-dots {
bottom: -30px;
}
.slick-slide:nth-child(odd) {
background: $c2;
}
JS:
$(".slider").slick({
autoplay: true,
dots: true,
variableWidth:true,
responsive: [{
breakpoint: 500,
settings: {
dots: false,
arrows: false,
infinite: false,
slidesToShow: 2,
slidesToScroll: 2
}
}]
});
原文由 Sandro 发布,翻译遵循 CC BY-SA 4.0 许可协议
我也一直在尝试解决这个问题。我找到了两种可以解决问题的方法。
第二种方法适用于大多数用例。