function ResizeIFrame() {
var buffer = 40; //scroll bar buffer
var height = document.documentElement.clientHeight -
pageY(document.getElementById('ifrm')) + buffer;
height = (height < 0) ? 0 : height;
$('iframe#ifrm').css('height', height + 'px');
}
function pageY(elem) {
return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) :
elem.offsetTop;
}
Where 'ifrm' is ID of iframe.
The only thing we need now is handing load and resize events:
window.onload = window.onresize = ResizeIFrame;
This could not be simpler!
I read a lot of interesting articles here. Probably you spend a lot of time writing,
ReplyDeletei know how to save you a lot of work, there
is an online tool that creates readable, google friendly articles in minutes,
just search in google - laranitas free content source