// Force 16/9 aspect ratio for a embed video.
<div class="app-aspect-ratio">
<iframe width="420" height="315" src="https://www.youtube.com/embed/9qSs-jE4bow" frameborder="0" allowfullscreen></iframe>
</div>
<script>
function video_aspect_ratio() {
var _this = $('.app-aspect-ratio').children();
var width = _this.width();
var height = Math.round((width / 16) * 9);
_this.css('height', height + 'px');
}
$(document).ready(function() {
website_video_aspect_ratio();
});
$(window).resize(function() {
website_video_aspect_ratio();
});
</script>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.