![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I currently have the <div> with style: - position: absolute; overflow-y: auto; overflow-x: hidden; width: auto; height: auto; |
#3
| |||
| |||
|
|
Anyway, cut a long story short, I want what en.wikipedia.org has on its search box. [...] Do I have to add scroll-bar width to the div-width with Javascript? Is there a CSS parameter/configuration that will give me wikipedia-esque width-expansion? Any pertinent advice gratefully accepted. |
#4
| |||
| |||
|
|
Le 11/2/09 2:39 PM, Richard Maher a écrit : I currently have the <div> with style: - position: absolute; overflow-y: auto; overflow-x: hidden; width: auto; height: auto; height: 5em; padding-right: 17px; |
|
OK with "my" Firefox IE ? -- sm |
#5
| |||
| |||
|
|
Richard Maher wrote: Anyway, cut a long story short, I want what en.wikipedia.org has on its search box. [...] Do I have to add scroll-bar width to the div-width with Javascript? Is there a CSS parameter/configuration that will give me wikipedia-esque width-expansion? Any pertinent advice gratefully accepted. RTSL. You're welcome. |
| PointedEars |
|
-- |
#6
| |||
| |||
|
|
Hi SAM, "SAM" <stephanemoriaux.NoAd... (AT) wanadoo (DOT) fr.invalid> wrote in message news:4aeeeba3$0$966$ba4acef3 (AT) news (DOT) orange.fr... Le 11/2/09 2:39 PM, Richard Maher a écrit : I currently have the <div> with style: - * position: absolute; * overflow-y: auto; * overflow-x: hidden; * width: auto; * height: auto; height: 5em; padding-right: 17px; Ok, is there a more heuristic way to derive "17"? IOW, how does one obtain the width of a browser's scrollbars at runtime? |
#7
| |||
| |||
|
|
Hi SAM, "SAM" <stephanemoriaux.NoAdmin (AT) wanadoo (DOT) fr.invalid> wrote in message news:4aeeeba3$0$966$ba4acef3 (AT) news (DOT) orange.fr... Le 11/2/09 2:39 PM, Richard Maher a écrit : I currently have the <div> with style: - position: absolute; overflow-y: auto; overflow-x: hidden; width: auto; height: auto; height: 5em; padding-right: 17px; Ok, is there a more heuristic way to derive "17"? |
|
IOW, how does one obtain the width of a browser's scrollbars at runtime? |
#8
| |||
| |||
|
|
You don't. You increase the width of the container until scrollWidth <= clientWidth. |
#9
| |||
| |||
|
|
Le 11/2/09 11:26 PM, Richard Maher a écrit : Hi SAM, "SAM" <stephanemoriaux.NoAdmin (AT) wanadoo (DOT) fr.invalid> wrote in message news:4aeeeba3$0$966$ba4acef3 (AT) news (DOT) orange.fr... Le 11/2/09 2:39 PM, Richard Maher a écrit : I currently have the <div> with style: - position: absolute; overflow-y: auto; overflow-x: hidden; width: auto; height: auto; height: 5em; padding-right: 17px; Ok, is there a more heuristic way to derive "17"? It seems that wikipedia choiced 20 px : if(r.containerCount < r.resultCount){ fix = 20; // give 20px for scrollbar line 253 of : http://fr.wikipedia.org/skins-1.5/common/mwsuggest.js?urid=243z2 IOW, how does one obtain the width of a browser's scrollbars at runtime? scrollbars are generally not far from 18px, setting the container width to 20px more must satisfy all browsers. wikidedia puts the items in cells and rows of a table (easier to code ? better for IE ?) then gets the width of the table (myTable.offsetWidth) then counts number of proposed items and adds the scrollbar (the 20px) when it's needed (more items than those allowed to see at same time) to finally fix the width of the div container. |
|
-- sm |
#10
| |||
| |||
|
|
Hi SAM, (..) Thanks for looking that up for me! Interesting to see what they've done. For others I recommend David's suggestion of using the scrollWidth - clientWidth differential. |
![]() |
| Thread Tools | |
| Display Modes | |
| |