固定宽度的滑梯与光滑的旋转木马

时间:2014-09-10 21:09:46

标签: jquery

是否可以实现这一点,即幻灯片不会根据视口大小调整宽度:我的示例在这里:

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>';
                  }
              }
            }
          ]
});

3 个答案:

答案 0 :(得分:17)

您可以使用可变宽度设置。这告诉你让你的css完成工作:

variableWidth: true

答案 1 :(得分:2)

检查您的slick.js版本 - 2014年9月30日,variableWidth已添加到版本1.3.8。

答案 2 :(得分:1)

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