Enhancing the IFrame WebPart
Description
http://blogs.tamtam.nl/mart/default,date,2005-06-07.aspx
<script type="text/javascript">
function resizeToFit(that){
var objNode = (typeof(this.nodeName)=='undefined') ? that : this ;
var objIframe = window.parent.document.getElementById('resizeToFit');
var intScrollX, intScrollY, intWinWidth, intWinHeight, intMaxWidth, intMaxHeight;
var intWhileCount = 0;
do{
// scroll the document by 1 pixel
window.scrollTo(1,1);
// measure the scroll position
intScrollX = (document.all) ? document.body.scrollLeft : window.pageXOffset ;
intScrollY = (document.all) ? document.body.scrollTop : window.pageYOffset ;
// measure window size
intWinWidth = (document.all) ? document.body.offsetWidth : window.innerWidth ;
intWinHeight = (document.all) ? document.body.offsetHeight : window.innerHeight ;
// if the scroll position is not 0
if(intScrollX>0){
// make the window larger
window.resizeBy(32,0);
// make the iframe larger
if(objIframe!=null && !document.all) objIframe.style.width = (objIframe.style.width=='') ? '64px' : (parseInt(objIframe.style.width) + 32) + 'px';
}
if(intScrollY>0){
// make the window larger
window.resizeBy(0,32);
// make the iframe larger
if(objIframe!=null && !document.all) objIframe.style.height = (objIframe.style.height=='') ? '64px' : (parseInt(objIframe.style.height) + 32) + 'px';
}
// count the steps
intWhileCount += 1;
}while((intScrollX>0 || intScrollY>0) && intWhileCount<900);
}
function waitToFit()
{
setTimeout("resizeToFit()",100);
}
onload = waitToFit;
</script>