[Users] Resizing a mapPanel with a windows onresize event with IE8
Phil Scadden
p.scadden at gns.cri.nz
Mon Jan 31 23:16:45 CET 2011
mapPanel is confined to a div within existing mark-up. However, I want
the div to resize so it fills the remaining screen. I had being using a
windows.onResize to calculation new dimensions and set the size
(using this code).
function pageY(elem) {
return elem.offsetParent ? (elem.offsetTop +
pageY(elem.offsetParent)) : elem.offsetTop;
}
var buffer = 10; //scroll bar buffer
function doResize() {
var height = window.innerHeight ||
document.body.clientHeight || document.documentElement.clientHeight;
var width = window.innerWidth || document.body.clientwidth
|| document.documentElement.clientWidth;
height -= pageY(document.getElementById('AllContents'))+
buffer ;
height = (height < 0) ? 0 : height;
if (mapPanel) mapPanel.setSize(width,height);
}
Works on all browser except IE.
On IE, the setsize calls the onresize event to be called again and this
then repeats, shrinking the map till height is zero.
Is there a better way to do this (I DONT want to use ext viewport or
layouts)? and what is the secret for doing this in IE?
Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
More information about the Users
mailing list