YouTube resizable
by jackbrown
HTML
<link rel="stylesheet" href="http://meyerweb.com/eric/tools/css/reset/reset.css">
<div id="videoContainer">
<iframe id="ytplayer" type="text/html" width="100%" height="100%"
src="http://www.youtube.com/embed/4A0waPVKudc?autoplay=1&enablejsapi=1&modestbranding=1&rel=0&showinfo=0&iv_load_policy=3"
frameborder="0" allowfullscreen>
</div>
SCSS
body {
background:blue;
}
#videoContainer {
width:90%;
height:70%;
display:block;
position:relative;
margin:50px auto;
}
JavaScript
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("ytplayer");
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
}
function onytplayerStateChange(newState) {
alert("Player's new state: " + newState);
}
//onYouTubePlayerReady('ytplayer');