views:

67

answers:

3

Hey,

I want to desactivate or remove the vertical scrollbar in an HTML page.

Thanks.

+4  A: 

If you really need it...

html { overflow-y: hidden; }
meder
put it where ?..
dotNET
Uhm, in a stylesheet or a `<style>` element.
meder
good, but it just hide the scrollbar; if I use the keyboard it scroll down. How can I desactivate the scrolling down ?
dotNET
The question was "remove the vertical scrollbar" and that did exactly that. You can try binding `keyup` or `keydown` to document and cancelling if the event code is equal to the down arrow, or reverting it with scrollTo(0,0) on the event handler.
meder
Example please ?
dotNET
Make a new question and specify exactly what you want please. Also state your level of Javascript please.
meder
ok i'm going to do this; thanks alot.
dotNET
@AZIRAR, I suppose it's too much to hope for that you would realise this was a bad idea :-) The contents of the browser window can rightly be thought of as "yours", the browser itself (scroll bars, close buttons, navigation away from the site and so on) belongs to the user. What happens when they don't have enough vertical space to render your page and you won't let them scroll down?
paxdiablo
+2  A: 

put this code in your html header:

<style type="text/css">
html {
        overflow: auto;
}
</style>
Greg McNulty
A: 

What I would try in this case is put this in the stylesheet

html, body{overflow:hidden;}

this way one disables the scrollbar, and as a cumulative effect they disable scrolling with the keyboard

Raine