$(document).ready(function(){ var ifr = $("#00L50561691M21L0"); 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();});