_V_("my_video_2").ready(function(){ var myPlayer = this; var aspectRatio = 264/640; function resizeVideoJS(){ var width = document.getElementById(myPlayer.id).parentElement.offsetWidth; myPlayer.width(width).height( width * aspectRatio ); } resizeVideoJS(); window.onresize = resizeVideoJS; });