Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable browser window scrolling of any kind?

Is there a way to disable scrolling? Not just the scrollbar, but the entire functionality from the browser window?

like image 628
scriptgeeky Avatar asked May 24 '12 20:05

scriptgeeky


People also ask

How do I disable scrolling element?

There's another way to disable scrolling that is commonly used when opening modals or scrollable floating elements. And it is simply by adding the CSS property overflow: hidden; on the element you want to prevent the scroll.

How do I lock scroll in Chrome?

Tapping the three dots menu at the top-right of an open and active note will reveal a new “Scroll Lock” option! This means that you can lock the page in place so you won't zoom or pan around with your wrist as you naturally rest it on the screen. Cursive's new “Scroll Lock” option rocks!


2 Answers

based on your answer to Keit you dont want to scroll be active when you have a lightbox open? if that is the case you can add a class to the body at the same time as you open the lightbox with the following css

And the nice thing about this solution it keeps the scroll "space" so the site do not jump, its more like it disables it. hope this helps

body.noscroll
{
    position: fixed; 
    overflow-y: scroll;
    width: 100%;
}



$('body').addClass('noscroll');
$('body').removeClass('noscroll');
like image 164
Dejan.S Avatar answered Sep 21 '22 02:09

Dejan.S


CSS

body
{
overflow: hidden;
}

javascript

document.body.style.overflow = "hidden";

jQuery

$("body").css('overflow', 'hidden');
like image 38
Keith Avatar answered Sep 21 '22 02:09

Keith