I'm trying to make my HTML5 element disappear when it loads (I currently see it with Javascript canplaythrough
, as you can see in the code you see below, but it's a little tough.) How can I make an HTML5 video element disappear soft? I'm fine with javascript or jquery, but I don't know a single one very well, so some complete code will be very useful!
Here is the code: (if you run the code using the code of the execution script, this will not work, so I highly recommend going to my site, this is my video page here and it works if you wait 30 seconds / min (before loading the video): jeffarries .com / videos .
<script> var e = document.getElementById("myVideo"); e.style.display = 'none' var vid = document.getElementById("myVideo"); vid.oncanplaythrough = function() { var e = document.getElementById("myVideo"); e.style.display = 'block' }; </script>
<video style="display: block;" id="myVideo" width="320" height="176" controls> <source src="http://www.jeffarries.com/videos/jeff_arries_productions_intro.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video>
Thank you for your time and effort!
source share