Reputation: 65183
I am trying to use jQuery to handle the scroling, so I want to get rid of the browser's scroll bar... how do I do that?
Upvotes: 3
Views: 6884
Reputation: 11767
The way to prevent the browser scroll bar using jQuery is to keep your document height less than your window height. Meaning you would need a wrapping div and make sure your content never exceeds the window height.
$(document).height();
$(window).height();
Not sure what you are trying to accomplish though.
as others have suggested you can use the CSS property
body{
overflow: hidden;
}
The actual use case would need to be presented to find which way would be best.
Upvotes: 2
Reputation: 1862
For finer control over which scrollbar to show and hide you can also use overflow-x and overflow-y. Browser support is a bit tricky. You can check it with this testcase if there is a solution for only get rid of the vertical scrollbar in your case.
Upvotes: 0
Reputation: 4828
well with css you could do that -> overflow:hidden
on the body tag but you will not be able to scroll down anymore if the page is larger then the browser screen (unless you use your keyboard arrows)
Upvotes: 7
Reputation: 168833
Use CSS: overflow:hidden;
will disable the scroll-bars of the element.
Not certain whether it will work on the whole page (ie at the body level), but you can always wrap your content in a div and style that.
Upvotes: 2