question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slick Init - Cannot pause slider

See original GitHub issue

Hello,

When trying to pause the slider within the init listener the “slick(‘slickPause’)” method doesn’t work with the error

Uncaught TypeError: Cannot read property 'slickPause' of undefined

An example piece of code is:

var opts = {
            autoplay: true,
            autoplaySpeed: 5000,
            speed: 750,
            fade: true,
            arrows: false,
            appendDots: $('.nav-wrap div'),
            dots: true,
};

$(elem).on('init', function(event, slick){
            var slider = slick.$slider;
            slider.slick('slickPause');
});

$(elem).slick(opts);

It seems like you need a ‘ready’ event or similar to help resolve this?

Thanks, Dean

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
JumpLinkcommented, Aug 4, 2016

Run $slider.slick('slickPause'); just after the initialization seems to be working: https://jsfiddle.net/yzxyh435/1/

So, $slider.slick({...}); seems to be sequential and not asynchronous and to wait for the event does not seem to be necessary.

Contradict someone?

1reaction
thielpetercommented, Apr 28, 2017

Its dirty but works 😕

$slider.on('init',function(event, slick){
  setTimeout(function(){$slider.slick('slickPause');}, 1);
});

$slider.slick({
  autoplay: true,
  pauseOnHover: false
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Slick Init - slickPause undefined - Stack Overflow
This would pause the carousel right away assuming the first slide is a video. If it's not always the first slide, you can...
Read more >
Developers - Slick Init - Cannot pause slider - - Bountysource
Hello,. When trying to pause the slider within the init listener the "slick('slickPause')" method doesn't work with the error
Read more >
[Resolved] Stop audio player in Slick carousel when ... - Toolset
Problem : I have a custom audio field displayed in a Slick carousel. When the carousel paginates, I would like to stop the...
Read more >
kenwheeler/slick - Gitter
I have a problem with slides made of multiple sub-divs. They show correctly when page is loaded. But when the infinite carousel goes...
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
slick is a responsive carousel jQuery plugin that supports multiple breakpoints, ... Initialize your slider in your script file or an inline script...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found