Responsive iframe for youtube or any embeded content
function resizeIframe() {
if ( $('iframe') ) {
var iframe = $('iframe');
iframe.each(function(){
var parent = $(this).parent();
var ratio = $(this).attr('width') / $(this).attr('height');
$(this).attr('width', parent.width());
$(this).attr('height', parent.width()/ratio);
});
}
}
// Event on document load
$(document).ready(function(){
resizeIframe();
});
// Event on resize window
$(window).resize(function(){
resizeIframe();
});