Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizing a popup to fit an image or full screen, whichever is smaller

Status
Not open for further replies.

inta

Technical User
Aug 2, 2001
13
AU
Hello,

I am trying to resize a popup to fit an image for IE, but when the image is bigger that the available screen size IE still goes to the image size. Below is the code I am trying to use.

The idea is to open a popup, load an image, resize the popup to the image. If the image is bigger than the screen, then resize the popup to the screen size.

I have it working in NS, all versions, but I cannot get it to work in any version of IE.

I would like it to work in IE for versions 4 and above

Your assistance is greatly appreciated.

if (isIE4) {
window.moveTo(0,0);
//window.resizeTo(500, 500);
width = 500 - (document.body.clientWidth - document.images[0].width);
height = 500 - (document.body.clientHeight - document.images[0].height);
if ( height > window.availHeight ) {
height == window.availHeight;
}
if ( width > window.availWidth ) {
width == window.availWidth;
}
window.resizeTo(width, height);
}
}
 
if (isIE4) {
window.moveTo(0,0);
//window.resizeTo(500, 500);
width = 500 - (document.body.clientWidth - document.images[0].width);
height = 500 - (document.body.clientHeight - document.images[0].height);
if ( height > window.availHeight ) {
height = window.availHeight;
}
if ( width > window.availWidth ) {
width = window.availWidth;
}
window.resizeTo(width, height);
}
}

there are no window.availHeight in IE, there is screen.availHeight
so, change 'em & it have to be working.. :)
Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top