lucas clemente lucas clemente - 3 months ago 9x
HTML Question

Deactivate body's scrolling but keep scroll bar

How do I disable

's scroll bar, but let it stay visible on screen? As an example see facebook's theatre mode:

facebook screen


This is the only CSS you will ned to force the scrollbars:

    overflow-y: scroll;

The scrollbars will be disabled if the content is smaller than the window, so you will have to use some script to resize the body to be at least 1px less then the window height:

$("body").css({ "height" : ($(window).height() - 1) + 'px', "overflow": "hidden" });