M
M
margaret_murka2021-10-11 04:23:37
JavaScript
margaret_murka, 2021-10-11 04:23:37

How to disable autoplay in Slick?

I'm trying to disable autoplay in the slick slider on clicking the dot . I
found such options, but it doesn't work
// in general, it doesn't work, I probably didn't understand something in the design

$('.single-item-main').slick('slickPause');
$('.single-item-main').slick('slickSetOption', { 'autoplay': false }, false);


the slider itself
$('.single-item-main').slick({
    draggable: true,
    adaptiveHeight: true,
    mobileFirst: true,
    infinite: true,
    dots: true,
    slidesToShow: 1,
    slidesToScroll: 1,
    cssEase: 'linear',
    accessibility: false,
    arrows: false,
    autoplay: true,
    autoplaySpeed: 5000,
    dotsClass: "my-dots",
    pauseOnDotsHover: false,
    pauseOnHover: false,
  });


with this setting, when you click on the button, the slider stops itself, but only while in focus,
if you click on another object on the page, the animation continues
, please tell me what the error is, well, or another solution, otherwise
you can’t find more information :(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
margaret_murka, 2021-10-11
@margaret_murka

Eh...
well,
$('.single-item-main').slick('slickPause'); works.
When you click on the button, just write,
but the problem was that the script was connected twice, if anyone is interested

D
Dpy3b, 2021-10-11
@Dpy3b

autoplay: false (in the slider itself),
remove autoplaySpeed ​​altogether

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question