Search
 
SCRIPT & CODE EXAMPLE
 

HTML

slick slider pause on video play

	<div id="slideBox">
		<!--Sidebar-->
			
		<div id="main-image" class="sliderMain">
			<div><img src="https://placeimg.com/640/480/any"></div>
			<div><img src="https://placeimg.com/640/480/any"></div>
			<div><img src="https://placeimg.com/640/480/any"></div>
			<div><img src="https://placeimg.com/640/480/any"></div>
			<div><img src="https://placeimg.com/640/480/any"></div>
			<div id="slide-video">
				<video width="900px" id="theVideo">
					<source src="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" />
				</video>
			</div>
		</div>
			
	</div><!--slideBox-->

<script>
		$(document).ready(function() {
    $('.sliderMain').slick({
        slidesToShow: 1,
        slidesToScroll: 1,
        arrows: false,
        fade: false,
        autoplay: true,
        autoplaySpeed: 3000,
        infinite: false,
    });

    $('.sliderMain').on('afterChange', function(event, slick, currentSlide) 
    {
        var video = $('.sliderMain .slick-active').find('video');
        if ($('.slick-current').find('video').length !== 0) 
        {
            $('.sliderMain').slick('slickPause');
            theVideo.play();
        }
    });
    document.getElementById('theVideo').addEventListener('ended', myHandler, false);
    function myHandler(e) 
  	{
        $('.sliderMain').slick('slickPlay');
    }
});
</script>
Comment

PREVIOUS NEXT
Code Example
Html :: bootstrap selec 
Html :: html5 progress 
Html :: video html 
Html :: bootstrap hide row 
Html :: bootstrap soft corner 
Html :: how to make a table in html 
Html :: bootstrap tabs 
Html :: ion icon image 
Html :: markdown to html 
Html :: javascript how to set a textbox value to nothing 
Html :: input number maxlength html 
Html :: html vs htm 
Html :: run another Html in html 
Html :: html css how to position elements on right of div 
Html :: typo3 typoscript page uid to body tag 
Html :: html email button 
Html :: bulma fullheight 
Html :: bootstrap 5.1 validation 
Html :: insert html in html 
Html :: del html 
Html :: &nbsp html 
Html :: html div 
Html :: the use of span tag 
Html :: change button color in html 
Html :: skip line html 
Html :: selenium click not working 
Html :: html2pdf page break option 
Html :: how to make bold text in html 
Html :: html make text bold 
Html :: bootstrap navvar 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =