PDA

View Full Version : detect width of windows


illogique
12-24-2003, 03:08 PM
hi there

i'm using document.body.clientWidth to get the width of the windows to build an image the correct size...

the problem is with mozilla and netscape, when they're a vertical scroll, my image is too big and a horizontal scroll appear.

since internet explorer always has a vertical scroll than the width is always correct.
opera is smart enouph to provide the size depending if they is a vertical scroll or not.
so only netscape and mozilla provide the width before the vertical scroll appear since it the first thing in my page...

is the're a way to get that correct size?
or maybe to always display a vertical scroll even if the content is smaller than the windows??

you can take a look at
http://illogique.dyndns.org:8080/bd/prototype.php

ucm
12-24-2003, 07:13 PM
you could create a borderless iframe with it's width style set to "width:100%;" and tell the iframe to do scrolling="no" ;)

illogique
12-25-2003, 01:15 AM
well i just try some iframe (for the first time!) and it can't do height=100%!!!
and since i have to scroll, i did scrolling=yes and it did the same thing like before...work in ie and opera and don't in mozilla and netscape

even in ie, it show 2 vert. scroll bar, very ugly!!

agent002
12-25-2003, 11:22 AM
Instead of that iframe thing, try putting

style="overflow: hidden;"

to the <body> tag, and you should get rid of the scrollbars.

illogique
12-25-2003, 11:59 AM
maybe i didn't explain correctly...
i want a vertical scroll! when needed or all the time but
i don't want an horizontal scroll!

since in mozilla, i take the width before the vertical scroll appear, when it appear, it does on top of my image making an horizontal scroll appear!

schnitzel_21st
12-25-2003, 10:05 PM
No need to crap your pants.

illogique
12-26-2003, 01:45 AM
de kecé?
crap my pants?
sorry you lost me here
btw english is my second language so i'm clueless on that one!

agent002
12-26-2003, 10:16 AM
Try this then:
<body style="overflow-x: hidden; overflow-y: visible;">

agent002
12-26-2003, 10:18 AM
Btw. he meant: Take it easy

illogique
12-26-2003, 12:36 PM
overflow-x and overflow-y doesn't work in mozilla

agent002
12-26-2003, 01:01 PM
Damn mozilla. Why?

illogique
12-26-2003, 01:39 PM
well i think it's a ie specific thing since it's not in the w3 standard...
it seem not to work in opera either