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