Click to See Complete Forum and Search --> : Window Resizing Problem


hys
04-27-2003, 04:36 AM
Ok guys this is a script i tried to run on my site however it doesnt work ... The purpose of the script is to maximize the window if it isn't already maximized or to reset the size to a set measurement as seen in the code


function resize(){

if ( window.height == screen.height ) {
top.window.resizeTo ( Math.ceil( "800" ) , Math.ceil( "600" ) );
top.window.moveTo ( Math.ceil( "50" ) , Math.ceil( "50" ) );
} else {
top.window.resizeTo ( Math.ceil( screen.width ) , Math.ceil( screen.height ) );
top.window.moveTo ( Math.ceil( "0" ) , Math.ceil( "0" ) );
}
}


Another fact is that the window was opened by script:


window.open("full.htm", "", "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");

khalidali63
04-27-2003, 08:41 AM
in your window.opne properties,you have this attribute with value
fullscreen=1
it forces IE to open a window taking up whole screen.once its full screen its not allowing it to resize( it seems like it).

use fullscreen=0 and here is updated version of your resize function

function resize(){

if ( document.body.offsetHeight == screen.height ) {
top.window.resizeTo ( Math.ceil( 800 ) , Math.ceil( 600 ) );
top.window.moveTo ( Math.ceil( 50 ) , Math.ceil( 50 ) );
} else {
top.window.resizeTo ( Math.ceil( screen.width ) , Math.ceil( screen.height )+25 );
top.window.moveTo ( Math.ceil( 0 ) , Math.ceil( 0 ) );
}
}

I have tested bove with IE6+

hys
04-27-2003, 06:05 PM
How do you get the return value of the window's height...

I used:


alert (window.height);


and it returned undefined

pyro
04-27-2003, 06:13 PM
You can get it in NN with window.outerHeight. Not sure what the IE way to do this would be, if there even is one...

hys
04-27-2003, 06:49 PM
Originally posted by Dave Clark


So, for IE, you are only told the inner dimensions of the client viewing area:

document.body.offsetWidth
document.body.offsetHeight

Dave

But does that only give the height of the document not the window... Because the document is in a frameset...

hys
04-27-2003, 07:53 PM
I have tested your script Dave and it works fine but a question:

I've tried to put it into a frame then i modified your script and realise there is a slight difference between

top.document.body.offsetHeight and document.body.offsetHeight

to preview this difference you may be required to put the script into frames.

hys
04-28-2003, 07:57 PM
Hello Guys,

I have achieved my objectives using top.document.body.offsetHeight.

The output can be viewed at:

http://offers.www4.dotnetplayground.com


however at the moment this has only been tested on IE 5.5 and 6... in addition on Windows 2000 and XP machines with 1024 x 768 resolution....