位置固定且宽度 100% 的元素覆盖 IE 中的垂直滚动条
我有一个宽度为 100% 且位置固定在页面顶部的 div。当 html 需要垂直滚动时,它会覆盖 IE 中的垂直滚动条。
我该怎么做才能避免这种情况(我无法更改位置固定位)?
我可以检测页面是否需要垂直滚动 onload/resize 并使用 jQuery 更改静态 div 的宽度吗?
或者
完全通过 CSS 解决它?
I have a div with WIDTH 100% and position fixed on the top of the page. It covers the vertical scrollbar in IE when vertical scrolling is needed on the html.
What can I do to avoid this (I can't change the position fixed bit)?
Can I detect whether page need vertical scrolling onload/resize and change that static div's width using jQuery?
or
Solve it through CSS altogether?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发现问题:我不小心将
overflow:auto
附加到body
标记上,而它仅适用于html
标记。Found the problem: I accidentally attached
overflow:auto
on thebody
tag when it was only meant for thehtml
tag.如果没有看到页面,很难说清楚,但是你可以添加一个条件样式表并在 ie 中将 div 移动超过 5px 左右,这样就不会发生这种情况吗?
right:5px
jquery 代码如下所示:
It is kinda hard to tell without seeing the page, but could you add a conditional stylesheet and move the div over 5px or so in ie so that doesn't happen?
right:5px
The jquery code for this would be something like: