Home > front end >  Why is slick slider setoption not working?
Why is slick slider setoption not working?

Time:12-05

Trying to use slickSetOption to set autoplay to true, will have this trigger another way eventually. But the problem is that when I try to use slickSetOption nothing happens. Any idea what I'm doing wrong here?

Codepen

  $(".slick-slider").slick({
   slidesToShow: 3,
   infinite:false,
   slidesToScroll: 1,
   autoplay: false,
   autoplaySpeed: 2000
  });
  
 $(".slick-slider").slick("slickSetOption", "autoplay", true, false);

CodePudding user response:

I don't know why slickSetOption is not working, but this does.

Change your code to this:

$(".slick-slider").slick({
  slidesToShow: 3,
  infinite: false,
  slidesToScroll: 1,
  autoplay: false,
  autoplaySpeed: 2000
});

$(".slick-slider").slick('slickPlay');
  • Related