Skip to content

Instantly share code, notes, and snippets.

@thedotmack
Created January 24, 2014 05:24
Show Gist options
  • Save thedotmack/8592447 to your computer and use it in GitHub Desktop.
Save thedotmack/8592447 to your computer and use it in GitHub Desktop.
$('iframe').each(function(){
src = $(this).attr('src').search('youtu');
console.log(src);
if (src > 0) {
$(this).before('<style>.embed-container { position: relative; padding-bottom: 60%; padding-top: 30px; height: 0; overflow: hidden; max-width: 100%; height: auto; } .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100% !important; height: 93% !important; }</style>').wrap('<div class="embed-container"></div>');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment