tags:

views:

94

answers:

5

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?

A: 

I highly doubt that's possible

m.edmondson
this is just a comment not an answer
Bobby Borszich
But what if the answer is that its not possible?
m.edmondson
Then you should say "that's not possible" and offer some citations if possible. If you're not sure if it is/isn't possible, then research it before answering.
STW
It is possible, though.
Jeff Rupert
yes it is possible, but if you don't even try to look for a correct answer then yes it is not possible
krike
+2  A: 

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.

Spudley
+5  A: 

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)

krike
Should we really be removing the users controls? I thought this was considered bad practice in the same way that pop-ups are. You will only disorientate the user. The user should be able to scroll if they want? Am I not correct?
m.edmondson
You are totaly right, i wanted to make a note about it but i had to leave. Removing the scrollbar indeed removes the usability of the website and it is not recommended
krike
well, I'm handling overflowing content differently, in a way, I feel is more intuitive (and lazier)
DerNalia
+2  A: 

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.

Bobby Borszich
that's not really necessary, he just wants it to be hidden. it can be done with css, see my answer. I tested it out on this site using firebug
krike
good point, I edited my answer
Bobby Borszich
A: 

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.

dantz
let's not make this to complicated, this not usefull at all
krike
Since the question is specific about the *vertical* scrollbar, this makes it just complicated enough.
David Dorward