Hey there, I have a dilemma with two divs. One is for displaying content, and the other is a video player that I want to pause and resume on scroll using jQuery.
My goal is to pause the video in the "myplayer" div on scroll and have it resume playing from the same point in the "getMyPlayer" div.
Thank you in advance.
$(window).scroll(function (event) {
var scroll = $(window).scrollTop();
if(scroll > 600)
{
$('#getMyPlayer').css('display','block');
}
else
{
$( '#myplayer' ).clone().appendTo( '#getMyPlayer' );
$('#getMyPlayer').css('display','none');
}
});
<div id="myplayer">
<iframe width="500" height="500" src="//www.ytapi.com/embed/<?php echo $yt->id ?>?autoplay=1" frameborder="0" allowfullscreen></iframe>
</div>
<div id="getMyPlayer"></div>