How to disable the scrolling of a web page?

14

I've been trying to disable scrolling a page. All I have found are solutions of the type:

#container{
  overflow: hidden;
}

But this just hides the scroll bar. How would I disable scrolling even with it being displayed on the screen ?

Issue

It does not matter if it will be or other web technology client-side , I just want to know if there is any way.

    
asked by anonymous 20.02.2014 / 00:47

6 answers

7

You could use javascript to lock the scroll anyway, setting the top always to 0 , every time any scroll event is called, see:

function setTopo(){
    $(window).scrollTop(0);
}
$(window).bind('scroll', setTopo);

And if you want to hide the scroll bar, you can apply the overflow: hidden; rule to your body.

    
20.02.2014 / 02:01
3

You can not disable the scroll, but you can "fix" an element in the document, so the scroll will have no effect.

Something simple like:

div.fixed { position: fixed; top: 0; left: 0; }

In your HTML:

<div class="fixed"> ... conteúdo ... </div>

If the "fixed" element is the only element in your document, you have, in practice, eliminated the scrolling of the entire document. Combine this with what you already had, which hid the scrollbars, and that's it.

Reference: link

    
20.02.2014 / 01:23
3

Involve your page in div with class specifies, for example:

<div class="wrap">Conteudo...</div>

And specify the height of all parent elements in 100% , so for example:

body, html {height:100%;}

and so:

div.wrap {height:100%; overflow:hidden;}

and set overflow hidden in body as well:

body {overflow: hidden; }

Demo

So you will not have scrolling ( scroll ) enabled on your page.

    
20.02.2014 / 01:13
2

EDIT

I found the following CSS in the English OS:

html
{
  position:fixed;
  width:100%;
  height:100%;
}

link

    
20.02.2014 / 02:27
2

Hello, You can remove with the following command in javascript:

$(document).ready(function(){
// REMOVER BARRAS DE ROLAGEM
  $("#SUADIV").click(function(){
    $("html, body").css({
        'height' : $(window).height() + 'px',
        'width' : $(window).width() + 'px',
        'overflow' : 'hidden'
    });
  });
});

It even identifies the size of your screen and removes the scrolls [X] and [Y], with CSS could remove overflow-x:hidden; overflow-y:hidden; but the above jQuery commands already do.

    
15.01.2016 / 20:36
0

Try this:     <body style="overflow:hidden;">

and come back to tell. ;) 0

    
28.01.2016 / 01:13