圆滑的传送带:使用img标签的width属性会损坏slidesToShow选项

时间:2019-06-05 14:07:45

标签: jquery css image carousel

在此fiddle中,我构建了一个光滑的轮播,该轮播使用img标签的height和width属性(对于该问题,我需要这些属性来实现超出范围的功能)。

JS:

$('.slider').slick({
  draggable: true,
  dots: true,
  infinite: false,
  arrows: true,
  variableWidth: true,
  variableHeight: true,
  rows: 0,
})

CSS:

.slide img {
height: auto;
}

.slide {
  margin: 0 0.25em;
}

尺寸会反映出来,但是尽管slidesToShow选项设置为3,但仍显示了3张以上的图像。我认为原因是滑块是通过图像的原始尺寸计算的。我该如何纠正?

0 个答案:

没有答案