Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fixed width slides with slick carousel

Tags:

jquery

Is there that this can be achieved ie so that the slides don't adjust in width depending on viewport size: My example is here:

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

And the code is as follows:

$('.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>';
                  }
              }
            }
          ]
});
like image 878
user1937021 Avatar asked Sep 10 '14 21:09

user1937021


People also ask

Is slick slider responsive?

Fully responsive. Scales with its container. Uses CSS3 when available. Fully functional when not.

How do I add slick to Carousel?

Make a choice: https://cdnjs.com/libraries/slick-carousel. https://www.jsdelivr.com/projects/jquery.slick. Afterwards, simply insert the CSS as links into the HTML page head and the JavaScript just before your closing body tag.


2 Answers

You can use the variable width setting. This tells slick to let your css do the work:

variableWidth: true
like image 97
Jeff Lindblom Avatar answered Oct 10 '22 11:10

Jeff Lindblom


If you set variableWidth to true, make sure you do not use the slidesToShow setting, or the slider will not advance.

like image 30
Taiger Avatar answered Oct 10 '22 13:10

Taiger