Jump to content


Photo

resize window to minimum


  • Please log in to reply
5 replies to this topic

#1 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 02 October 2006 - 03:11 PM

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?

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 02 October 2006 - 03:23 PM

In firefox they only appear if there is somewhere to scroll to.

#3 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 02 October 2006 - 03:39 PM

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?

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 October 2006 - 12:09 AM

I'm not sure if .clientHeight or .offsetHeight is the right one, but I believe that one will give you the dimensions you require.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#5 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 03 October 2006 - 03:28 AM

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.

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 October 2006 - 03:06 PM

Yeah, it's an annoying game... you can IE expressions (ugh), and deal with Gecko-browsers separately, or just hard-code it.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users