I am interested in setting up an HTML page with multiple video clips such that each video clip plays only while visible and then pauses when out of view.
I have fo
Need to check if the video is visible during the scrolling.
$(window).scroll(function() { $('video').each(function(){ if ($(this).is(":in-viewport")) { $(this)[0].play(); } else { $(this)[0].pause(); } }) });