javascript 在 IE 中禁用滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3806680/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 02:18:47  来源:igfitidea点击:

disable scroll bar in IE

javascriptjqueryhtmlinternet-explorer

提问by Rahul Utb

Possible Duplicate:
Disable browsers vertical and horizontal scrollbars

可能的重复:
禁用浏览器垂直和水平滚动条

Can I disable vertical scroll bar in IE.

我可以在 IE 中禁用垂直滚动条吗?

回答by Robert Greiner

If you want to disable the scroll bar for a form element, you can use the following code:

如果要禁用表单元素的滚动条,可以使用以下代码:

style="overflow-y:hidden"

If you want the actual browser to not have a scroll bar, you can apply the same style to the html element.

如果您希望实际浏览器没有滚动条,您可以对 html 元素应用相同的样式。

html {
    overflow-y: hidden;
}

If you want to disable both scroll bars:

如果要禁用两个滚动条:

overflow: hidden

回答by mplungjan

And in case you want to use just html attributes:

如果您只想使用 html 属性:

<body scroll="no">

to disable scroll in IE completely

在 IE 中完全禁用滚动

Let the down voting begin ;)

让投票开始;)

回答by methodin

In CSS you can do:

在 CSS 中,您可以执行以下操作:

html, body {
overflow-y:hidden;
}

回答by Gabe

Disabling scroll bars with css

使用 css 禁用滚动条

overflow-x:hidden
overflow-y:hidden