Jump to content

resize window to minimum


michaellunsford

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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.