K
K
Kripto772017-09-15 08:29:29
JavaScript
Kripto77, 2017-09-15 08:29:29

How to make the Slick slider without looping not scroll the slides to the left until the last one?

https://jsfiddle.net/65n62w3b/3/ Responsive slider without looping

- the number of slides shown is not known in advance - can be from 2 to 7

beyond the right border of the container

There is too much empty space on the right

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kalibrov, 2017-09-15
@Kripto77

You can calculate in advance how many slides you can fit at different screen resolutions, and use the responsive property to set the necessary breakpoints, like this:

$('.slider').slick({
  variableWidth: true,
  dots: false,
  infinite: false,
  slidesToShow: 5,
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 4
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 3
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 2
      }
    }
  ]
});

https://jsfiddle.net/65n62w3b/6/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question