[jQuery] Strange problem getting width/height

[jQuery] Strange problem getting width/height


Hello to everybody, I'm writing you since I'm getting a strange
problem with getting height/width of a div I've inserted with div.html
(data);
Ive got this HTML :
<div id="rootDiv" style="border: 1px solid #BAD3E0; visibility:
hidden;">
<div id="content">
</div>
<div id="navigation" style="width: 20%; text-align: left;
display: block;">
<div id="prevButton" style="margin: 0px 2px 2px 2px;
float:left;">
<img src="images/prev.jpg" id="imgPrev" alt="prev" /></
div>
<div id="nextButton" style="margin: 2px;">
<img src="images/next.jpg" id="imgNext" alt="next" /></
div>
</div>
</div>
I need to autoresize the rootDiv at the size of the div('#content')
Here's the javascript:
var currentPage = 0;
var maxPage = 0;
var idDIV = DIV_ID;
var args = {
'lang': lang,
'keyword': keyword,
'servicename': servicename,
'size': size,
'sourceSite': sourceSite,
'showSuggested': showSuggested,
'action': action
};
var xhr = $.post(url, args, function(data) {
var div = $('#content');
div.html(data);
currentPage = xhr.getResponseHeader('currentPage');
maxPage = xhr.getResponseHeader('maxPage');
(*)
$(document).oneTime(2000, function(data) {
var iframe = div.find('#PanelRSSyahoo')[0];
if (iframe != null) {
$('#rootDiv').css('width', iframe.clientWidth);
$('#rootDiv').css('visibility', 'visible');
if (currentPage == 0)
$('#prevButton').css('visibility', 'hidden');
else
$('#prevButton').css('visibility', 'visible');
if (currentPage == maxPage)
$('#nextButton').css('visibility', 'hidden');
else
$('#nextButton').css('visibility', 'visible');
}
});
});
I had to insert the oneTime function otherwise after the (*) I got the
whole width size... it's as if the DOM refreshed after a little bit of
time... but this cause the page to show up two seconds later... any
suggestion??
Thanks in advance
Paolo