2014-09-10 87 views
5

固定宽度的幻灯片有,这是可以实现的,即让幻灯片不依赖于视口大小宽度调节:我的例子是在这里:用油滑转盘

http://machinas.com/wip/hugoboss/responsive-template/v4/

而且代码如下所示:

$('.main-slider').slick({ 
     centerMode: true, 
     centerPadding: '0px', 
     slidesToShow: 3, 
     dots: true, 
     speed: 1200, 
     slidesToScroll: 1, 
      infinite: true, 
      customPaging: function(slick,index) { 
       return $('.thumbnails').eq(index).find('img').prop('outerHTML'); 
      }, 
      responsive: [ 
      { 
       breakpoint: 640, 
       settings: { 
       arrows: false, 
       dots: true, 
       centerMode: false, 
       slidesToShow: 1, 
       customPaging: function(slick,index) { 
        return '<button type="button" data-role="none">' + (index + 1) + '</button>'; 
        } 
       } 
      } 
      ] 
}); 
+0

相关http://stackoverflow.com/questions/23273506/how-can-i-change-the-width-and-height-of-slides-on-slick-carousel – 2016-02-09 10:39:07

回答

15

您可以使用变量宽度设置。这告诉光滑,让你的CSS做的工作:

variableWidth: true 
+1

我忙了好几个小时 - 感谢这个!! @ user1937021请将此标记为答案。 – TheBlackBenzKid 2016-09-29 08:48:52

+0

说真的,我爱你。 - 谢谢,你救了我的屁股。 :) – belthazorNv 2017-11-19 15:15:31

2

检查slick.js版本 - variableWidth加入到1.3.8版本,在9月30日,2014年

1

如果设置variableWidth为true,确保你不使用slidesToShow设置,否则滑块不会前进。