Last active
          September 21, 2020 20:37 
        
      - 
      
- 
        Save smjuber/76e0229d41a58e091a04a41089f934d3 to your computer and use it in GitHub Desktop. 
    hide a HTML5 video when it finishes playing
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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