gpt4 book ai didi

javascript - 删除 Internet Explorer 中的滚动条

转载 作者:行者123 更新时间:2023-11-30 14:22:06 26 4
gpt4 key购买 nike

我有一个布局页面,我在每个页面中都使用它。在这些 Cshtml 页面中,我需要从一些页面中删除滚动条。我给了一个代码,它在谷歌浏览器中工作正常,但在 Internet Explorer 中失败。谁能帮我?在此先感谢。我的代码在下面

document.getElementsByTagName('body')[0].style = 'overflow: hidden';

最佳答案

也许是在 IE 中产生滚动条的 html 元素。试试这个:

document.getElementsByTagName('body')[0].style = 'overflow: hidden';
document.getElementsByTagName('html')[0].style = 'overflow: hidden';

我通常用这样的 CSS 来处理这个问题:

html
{
height: 100%;
margin: 0;
padding: 0;
overflow:hidden;
}
body
{
height: 100%;
margin: 0;
overflow:hidden;
}

关于javascript - 删除 Internet Explorer 中的滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52589098/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com