$(document).ready(function(){ var ifr = $("#08A00050556S62M0"); ifr.data("ratio", ifr.attr("height")/ifr.attr("width") ); ifr.removeAttr("width").removeAttr("height"); // Resize the iframes when the window is resized $(window).resize(function(){ var width = ifr.parent().width(); ifr.width(width).height(width * ifr.data("ratio")); }).resize();});