Cloning Additional Slides for Slick Slider

I am using jQuery Slick Slider to create a left aligned, infinite, variable width slider. Here is a JSFiddle: http://jsfiddle.net/mtaube/rLkj3wcn/2/

Basic initialization and settings using the default theme:

$('.js-slick').slick({
    dots: true,
    variableWidth: true,
    arrows: true,
});

      

Here is the start of the slider that appears at will:

enter image description here

The problem is that when you reach the last slide, a bunch of spaces appear before the new slides appear:

enter image description here

Is there a way to avoid this? I need to remove a temporary space. Thanks in advance.

+3


source to share


4 answers


Answering my question ... apparently this is a known bug with jQuery Slick Slider .

There are some bug reports on GitHub, here is the most appropriate one for those trying to subscribe to the issue: https://github.com/kenwheeler/slick/issues/1207



Apparently some hacks are posted on the GitHub report, but it didn't work for me as it broke the "dots" setting. I'll update this answer in case the error is eventually resolved. Thanks anyway.

0


source


Add to infinite: false



It will solve the white space issue as well as the slider cloning issue.

+3


source


You have the following options:

infinite: false,
slidesToShow: 3

      

+2


source


This happens to me when I have 2 items in a row. If you know the number of items that can be displayed without scrolling, you can set a variable - in my case, I could get 6 items on the screen without having to scroll

var infiniteScroll = true
if (noOfItems < 7)
{
infiniteScroll = false
}

$('.variable-width2').slick({
dots:true,
infinite: infiniteScroll,
draggable: true,
pauseOnHover: true,
swipeToSlide: true,
adaptiveHeight: false,
centerMode: false,
variableWidth: true,
arrows: false,
slidesToShow: 1,
slidesToScroll: 2,
initialSlide: 1,
rows: 2,
responsive: [
{
          breakpoint: 1023,
          settings: {
            infinite: infiniteScroll,
            draggable: true,
            pauseOnHover: true,
            swipeToSlide: true,
            adaptiveHeight: false,
            centerMode: false,
            variableWidth: true,
            arrows: false,
            slidesToShow: 1,
            slidesToScroll: 2
          }
        },
        {
          breakpoint: 600,
           // settings: "unslick"
          settings: {
            infinite: infiniteScroll,
            draggable: true,
            pauseOnHover: true,
            swipeToSlide: true,
            adaptiveHeight: false,
            centerMode: false,
            variableWidth: true,
            arrows: false,
            slidesToShow: 1,
            slidesToScroll: 2
          }
        }]
    });

      

+1


source







All Articles