Skip to content

Instantly share code, notes, and snippets.

@tvdeyen
Created May 23, 2012 11:05
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 tvdeyen/2774577 to your computer and use it in GitHub Desktop.
Save tvdeyen/2774577 to your computer and use it in GitHub Desktop.
Responsive iframe resizing
$(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