Last active
April 29, 2017 09:55
-
-
Save kirandash/61686f8d6e8a61fa0511d8098401428e to your computer and use it in GitHub Desktop.
Slick image and video fade effect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
/******************************** | |
* Banner Home * | |
********************************/ | |
$('#banner-home').slick({ | |
slidesToShow: 1, | |
slidesToScroll: 1, | |
arrows: false, | |
fade: true, | |
autoplay: true, | |
autoplaySpeed: 3000, | |
dots: true | |
}); | |
$('#banner-home').on('afterChange', function(event, slick, currentSlide){ | |
if ($("#banner-home .slick-current .banner-video").length) { | |
$('#banner-home').slick('slickPause'); | |
$("#banner-home .slick-current .banner-video video")[0].play(); | |
} | |
}); | |
$(".banner-video video").bind("ended", function() { | |
// Continue slick movement and go to next slide | |
$('#banner-home').slick('slickPlay'); | |
$('#banner-home').slick('slickNext'); | |
}); | |
})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment