I did it in jsfiddle.net, so here is the link if you want to check this:
http://jsfiddle.net/4LQFc/5/
Here is a summary:
This is your HTML:
<!DOCTYPE html>
<html>
<body>
<div id="div_loaded">loaded div</div>
<p id="get_dimentions"></p>
<iframe src="" id="iframetosize"></iframe>
</body>
</html>
Some additional CSS ... for demo purposes:
p {
margin:10px;
padding:5px;
border:2px solid #666;
}
#div_loaded {
position:relative;
display:block;
margin:10px;
padding:5px;
border:2px solid #666;
height:30%;
width:30%;
}
#iframetosize {
margin:10px;
padding:5px;
background-color:#000;
color:#fff;
}
This is jQuery (ugly but working):
var getsize = $("#div_loaded");
$("#get_dimentions").text( "Width: " + getsize.outerWidth() + " , Height: " + getsize.outerWidth(true) );
var sizewidth = getsize.outerWidth();
var sizeheight = getsize.outerHeight();
$("#iframetosize").css('height',sizeheight);
$("#iframetosize").css('width',sizewidth);
, . ( ) ..css , . , CSS , outerWidth (true) vs().