Jump to content

Archived

This topic is now archived and is closed to further replies.

michaellunsford

resize window to minimum

Recommended Posts

window.resizeTo(300,200) work great on some browsers, but not on others. The "goal" is to have the window the minimum width and height allowed without presenting scroll-bars.

I know what you're thinking, "yeah, turn off the scroll bars" but that is not a solution. IE's toolbar is apparently counted as screen height, so if they have all kinds of google bars, button bars, blah blah, 200 just isn't tall enough to display all the information on the page. If I make it 400, then firefox, safari, camino, pick one will have an extra 200px of white space at the bottom.

Is there some way to find out at what point the auto-scroll-bars will disappear?

Share this post


Link to post
Share on other sites
Yes, I am aware of when they appear. The problem is I want to make the page as small as possible without them appearing. So, I repeat the question: Is there a way to determine at what point scroll-bars will appear?

Share this post


Link to post
Share on other sites
I'm not sure if .clientHeight or .offsetHeight is the right one, but I believe that one will give you the dimensions you require.

Share this post


Link to post
Share on other sites
hmmm... document.clientHeight and document.offsetHeight both return the current window height in safari. Apparently these don't translate to firefox using just "document". However, Firefox (and everything else, for that matter) will tell me how tall a DIV is (although it's calculation is lower than the actual number).

For fun, I made a little setInterval loop that measures the size of the DIV and makes the page that size. It would drop the page height by about 100px with each loop. At the end of the day, I had to just hardcode the height in and hope for the best.

Share this post


Link to post
Share on other sites
Yeah, it's an annoying game... you can IE expressions (ugh), and deal with Gecko-browsers separately, or just hard-code it.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.