Created
May 23, 2012 11:05
-
-
Save tvdeyen/2774577 to your computer and use it in GitHub Desktop.
Responsive iframe resizing
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
$(document).ready(function(){ | |
$(window).on('resize', function() { | |
var padding = 0; | |
var width = $(window).width() - (2 * padding); | |
var ratio = 9/16; | |
$('iframe').css({width: width, height: width*ratio}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment