Pause Slick Video on Click

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.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.