video height to container jquery

by ian_smithz

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

<video controls>
  <source src="http://www.html5rocks.com/en/tutorials/video/basics/Chrome_ImF.mp4" type="video/mp4">
  <source src="http://www.html5rocks.com/en/tutorials/video/basics/Chrome_ImF.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

CSS

*{
    margin:0px;
    padding:0px;
}

JavaScript

var $video  = $('video'),
    $window = $(window); 

$(window).resize(function(){
    
    var height = $window.height();
    $video.css('height', height);
    
    var videoWidth = $video.width(),
        windowWidth = $window.width();
    
    $video.css({
        'height': height
        
    });
}).resize();