Created
December 8, 2014 17:03
-
-
Save fuddl/41fa6bcb50abb459e73e to your computer and use it in GitHub Desktop.
Youtube iframe responsive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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