1

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.

4

4 回答 4

2

尝试改用溢出-y。像这样

body {
    overflow-y:hidden;
}
于 2013-09-29T18:06:45.027 回答
2

如果您仍然可以滚动,则问题可能不是body标签,而是html标签占用超过 100%,也试试这个,它为我解决了类似的问题:

html {
    overflow: hidden;
    height: 100%;
}
于 2019-03-06T15:55:42.030 回答
1

您可以防止鼠标中键单击,因此您将无法滚动:

$(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.
});
于 2013-09-29T18:05:34.543 回答
1

使用 css 重置,或者:

*{margin:0;}
于 2013-09-29T18:09:44.580 回答