Skip to content

Instantly share code, notes, and snippets.

@fuddl
Created December 8, 2014 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuddl/41fa6bcb50abb459e73e to your computer and use it in GitHub Desktop.
Save fuddl/41fa6bcb50abb459e73e to your computer and use it in GitHub Desktop.
Youtube iframe responsive
// embedd your youtube iframe using youtube as element class: <iframe class="youtube"…
$(function() {
var windowE = $(window);
windowE.bind('resize', function() {
$('iframe.youtube').each(function() {
var iframe = $(this);
var width = iframe.width();
var height = width * .61;
iframe.height(height);
});
});
windowE.trigger('resize');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment