March 20, 2019
Slick Slider has pause and play functions available, but they are not easily enabled.
If you’re using videos in your slider, setting up a “play” button can help pause the slide progression on click.
var monitor = setInterval(function(){ var elem = document.activeElement; if(elem && elem.tagName == 'IFRAME'){ // check for iframe video clearInterval(monitor); jQuery('.home-slider').slick('slickPause'); } if(elem && elem.tagName == 'VIDEO'){ // check for html5 video clearInterval(monitor); jQuery('.home-slider').slick('slickPause'); } }, 100);
You can use similar functions with slickPlay to continue playing the slideshow.