Afonso Luis
Afonso Luis

Reputation: 643

CSS Body unscrollable?

I've put:

body {
height: 100%;
width: 100%;
max-height: 100%;
max-width: 100%;
overflow: hidden;
}

But I can still use my Middle Button to scroll down the page. Is there any fix for this?

I've also tried to search for the jQuery middle mouse button scroll event but didn't find anything.

Upvotes: 1

Views: 4012

Answers (4)

David Thompson
David Thompson

Reputation: 154

If you're still able to scroll, the issue may not be the body tag, but the html tag taking up more than 100%, try this as well, it resolved a similar issue for me:

html {
    overflow: hidden;
    height: 100%;
}

Upvotes: 3

oboshto
oboshto

Reputation: 3627

Use css reset, or:

*{margin:0;}

Upvotes: 1

Maxim Ershov
Maxim Ershov

Reputation: 1284

Try to use overflow-y instead. Like this

body {
    overflow-y:hidden;
}

Upvotes: 2

Rajesh
Rajesh

Reputation: 3778

You can prevent middle mouse clicks, so you wont be able to scroll:

$(document).mousedown(function(e){
switch(e.which)
{
    case 2:
        //middle Click
        return false;
    break;
}
  return true;// to allow the browser to know that we handled it.
});

Upvotes: 1

Related Questions