Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fade out html5 video object after play

I have a landing page and all I want to do is fade out the object after it finishes playing to reveal the background underneath. Fading out either the <video> or the <div> tags using jQuery or any other method is fine.

<div id="video">
<video width="100%" height="auto" autoplay="autoplay">
  <source src="monarch.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="monarch.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>
</div>
like image 950
Vinnie James Avatar asked Aug 10 '12 05:08

Vinnie James


1 Answers

Try the following:

$('#video video').bind('ended', function(){
   $(this).parent().fadeOut()
})
like image 185
undefined Avatar answered Oct 07 '22 12:10

undefined