A
A
Andrey2021-05-21 09:35:20
Slick
Andrey, 2021-05-21 09:35:20

Slick slider - why is the second one not displayed?

when I try to display 2 sliders, the first one starts, the second one doesn’t,
I’m not strong in js , I
copy the initialization code, I substitute the desired container class
, maybe something else needs to be changed here? i.e. I suspect that something is duplicated

const init = {
  autoplay: true,
  infinite: true,
  cssEase: "linear",
  slidesToShow: 2,
  slidesToScroll: 1,
  dots:true
};
$(() => {
  const win = $(window);
  const slider = $(".slider-one");

  win.on("load resize", () => {
    if (win.width() < 420) {
      slider.not(".slick-initialized").slick(init);
    } else if (slider.hasClass("slick-initialized")) {
      slider.slick("unslick");
    }
  });
});


I copy it, I only change the class to .slider-tho,

what else needs to be replaced?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question