Slick slider pause youtube video when slide change

余生颓废 提交于 2019-12-05 18:41:01

Adding off of Sequence's answer, this will allow the slider to function even if there is more than one slider on the page.

$('.mainSlider').on('beforeChange', function(event, slick, currentSlide, nextSlide){
  var current = $(slick.$slides[currentSlide]);
  current.html(current.html());
});

I would reset the HTML content. It will kill the IFrame and rebuild it.

var slider =  $('.mainSlider').slick({
    slidesToShow: 1,
    autoplay: false,
    autoplaySpeed: 5000
});

slider.on('beforeChange', function(event, slick, currentSlide, nextSlide){
    var current = $('.slick-current');
    current.html(current.html());
});
Amaljith

Check the simplest way, Current slide iframe src reset:

$('.mainSlider').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
       $('.slick-current iframe').attr('src', $('.slick-current iframe').attr('src'));
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!