javascript - Dim background when video is played -


i using html5 video element lot more now. i'd dim background of page when user presses play on video. when press pause or video ends, want screen turn off dim.

i have div on page set display: none not visible on page when loads i'm not familiar enough javascript want.

here div on page sets dim.

<div id="overlay" style="display:none;position:fixed;width:100%;height:100%;top:0;left:0;opacity:0.6;"></div> 

video html

<div class="col-md-6">     <div id="introright">         <video poster="img/whoweare.jpg" preload="auto" controls>         <source src="video/whoweare_hi.mp4" type='video/mp4; codecs="avc1.42e01e, mp4a.40.2"'>         <source src="video/whoweare_hi.ogv" type='video/ogg; codecs="theora, vorbis"'>         <source src="video/whoweare_hi.webm" type='video/webm; codecs="vp8, vorbis"'>         </video>     </div> <!-- end introright --> </div> 

$('video').on('play', function(e) {    $("#overlay").show(); }, true);  $('video').on('pause', function(e) {  $("#overlay").hide(); }, true);  $('video').on('ended', function() {   $("#overlay").hide(); }); 

maybe outlined above?


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -