lucas clemente lucas clemente - 1 year ago 127
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

Answer Source

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" });
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download