Skip to content

Instantly share code, notes, and snippets.

@smjuber
Last active September 21, 2020 20:37
Show Gist options
  • Save smjuber/76e0229d41a58e091a04a41089f934d3 to your computer and use it in GitHub Desktop.
Save smjuber/76e0229d41a58e091a04a41089f934d3 to your computer and use it in GitHub Desktop.
hide a HTML5 video when it finishes playing
onended="videoEnded()";
// To your video tag, and then just have a function videoEnded() hide the video.
// Or with just a jQuery function… I'm writing this without testing, so hopefully it will work-
$('video').on('ended',function(){ $(this).hide(); });
// Thanks, Ended up getting it working with this:
$('#vid2').hide();
$('#vid1').on('ended',function(){
$('#vid2').show();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment