Alegro
Alegro

Reputation: 7956

How to keep vertical scrollbar always present on the body?

$("#btnGall").click(function() {
    $('#home,#vid,#story,#con').hide();
    $('#gall').slideDown('slow');
}); 

After the first line the screen is almost empty and scrollbar disappears, moving the rest of the page to the right.
After the second line - scrollbar reappears, and again shift whole of the page.
How to prevent this ?

Upvotes: 2

Views: 294

Answers (1)

canon
canon

Reputation: 41665

You can apply overflow-y to html.

html { overflow-y: scroll }

If I recall, applying that to body will cause double scrollbars on IE.

Edit: Here's a sample.

Upvotes: 2

Related Questions