jquery - Trigger event after HTML looped video plays once, while keeping the video looping forever -


i can event trigger following code:

html:

<div style = "z-index:-10">      <video id ="moonvid" width="100%"  autoplay="" type="video/mp4" src="vid/clip 4lownosoundhand.mp4"></video>  </div> 

jquery:

 $("#moonvid").bind('ended', function(){   //console.log("here go!")   $('html, body').animate({       scrolltop: $("#slide-2").offset().top     }, 3000); 

});

but when add loop attribute video tag:

<div style = "z-index:-10">      <video id ="moonvid" loop= "" width="100%"  autoplay="" type="video/mp4" src="vid/clip 4lownosoundhand.mp4"></video>  </div> 

the event doesn't fire, makes sense since video still playing, (or never ending) , never calls event. question how fire jquery event after video plays once, while keeping video running indefinitely.

ideas? , many in advance rad community!

i did not test , it's seems logic me try , let me know

remove loop attribute

$("#moonvid").bind('ended', function() {     $(this)[0].play();     $('html, body').animate(     {       scrolltop: $("#slide-2").offset().top     }, 3000); }); 

Comments