views:

200

answers:

2

I have a Javascript tabbed dialog whose pages have different heights. Some of them are taller than the browser window.

In Internet Explorer, there is always a scrollbar to the right. When it is not needed, it is greyed out. The page dimensions stay the same and there is no problem.

In Firefox, the Scrollbar is hidden completely when not needed constantly changing the page's dimensions on each page change and thus the width of the whole tabbed dialog (it has a relative width). This is very annoying.

Is there any way to bring the deactivated scrollbar "back" to Firefox, or any other way to work around this?

+5  A: 

Add the following line to your userContent.css:

html { overflow: -moz-scrollbars-vertical !important; }
Franz
I should add that this solves the problem of "jumping" in every web application having that "problem".
Franz
I added it to the site's stylesheet that I'm working on and as far as I can see, it works. How cool is that? Thanks a lot!
Pekka
If this annoys you in other web applications, too, I suggest you really add it to your `userContent.css` file. This lets you apply custom styles to all websites.
Franz
-moz-scrollbars-vertical is Firefox (Gecko) specific. It won't work in other browsers.
Phil Ross
Well, it's only about Firefox...
Franz
@Franz, thanks for the userContent.css hint, but I need it to work globally. Still good to know.
Pekka
What do you mean by globally? This does work for every page in Firefox, if you add it to `userContent.css`.
Franz
+8  A: 

You can use the CSS3 overflow-y property:

html
{
  overflow-y: scroll;
}

This works in Firefox, Chrome, Safari and IE 8.

Phil Ross
It does - I didn't know this neither, cheers - but it adds bars both horizontally and vertically. I need only the vertical ones.
Pekka
I've updated my answer - it seems the CSS3 overflow-y property is widely supported, which will let you enable just the vertical scrollbar.
Phil Ross