Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable the scroll bars of a page?

how to disable the scroll bars of the page.

and disable this button.

alt text

like image 569
faressoft Avatar asked Aug 31 '10 17:08

faressoft


5 Answers

This will remove your scroll bar. [I did it by accident]

@media screen{        
body>div#header{        
position:fixed;        
}        
body>div#footer{        
position:fixed;        
} `
like image 77
Warren Avatar answered Oct 08 '22 10:10

Warren


The scrollbars are a CSS issue. You can add this to your page (or the inner part to a CSS file):

<style type="text/css">
html, body {
  overflow: hidden;
}
</style>
like image 37
palswim Avatar answered Oct 10 '22 23:10

palswim


You can't disable that button (or any other method of scrolling the page); see this. However, you could scrollTo(0,0) anytime you detect scrolling. This might look ugly (page scrolls a bit, then jumps back up).

For disabling the scrollbars, you can try setting html, body { overflow: hidden }; I think some browsers may not honor this.

(Wouldn't it be better to just create a page that fits into the viewport, so that the scrollbars aren't shown?)

like image 7
Piskvor left the building Avatar answered Oct 10 '22 23:10

Piskvor left the building


$(window).scroll(function() {
    scroll(0,0);
});

If you want to use it you need to have jQuery imported.

like image 7
faressoft Avatar answered Oct 10 '22 21:10

faressoft


document.body.scroll = "no";
document.body.style.overflow = 'hidden';
document.height = window.innerHeight;

should disable the scrollbars in most browsers.

See: http://www.eggheadcafe.com/community/aspnet/3/10088543/how-to-disable-document-body-from-scrolling.aspx

like image 1
Adam Avatar answered Oct 10 '22 21:10

Adam