Internet Explorer 绝对定位元素错误
天啊,
对于绝对定位的元素,我在 IE (8/7/6) 上遇到了非常奇怪的行为。它的样式为:
position: absolute; right: 5px; top: 0px; z-index: 5000;
并且 有一个垂直滚动条。
首次渲染页面时,将渲染绝对定位的 div,以便从 元素的边缘获取 5 个像素。但只要主体中存在
:hover
或 AJAX 事件,绝对定位的元素就会重新渲染,现在 5 个像素是从滚动条边缘获取的!
标记/CSS 太大/太复杂,无法在此处发布,但我在右上角附加了“活动”选项卡的一些屏幕截图:
首次呈现页面时:https://i.sstatic.net/SMkbb.jpg
当AJAX事件触发时:https://i.sstatic.net/3N9lg.jpg
我尝试确保这不是 hasLayout 问题,我什至尝试过 JavaScript 在某些事件上“纠正”元素的样式但在这两种情况下,IE 认为“正确”的值为“5px”。
你知道这里的问题可能是什么吗?
谢谢。
G'day,
I'm getting really weird behavior on IE (8/7/6) for an absolutely positioned element. It is styled as:
position: absolute; right: 5px; top: 0px; z-index: 5000;
and the <body>
has a vertical scrollbar.
When the page is first rendered, the absolute positioned div is rendered such that the 5 pixels are taken from the edge of the <body>
element. But whenever there is a :hover
or AJAX event in the body, the absolutely positioned element is re-rendered and now the 5 pixels are taken from the edge of the scrollbar!
The markup/css is too big/complicated to post here, but I've attached some screenshots of the 'activity' tab in the top right corner:
When the page is first rendered: https://i.sstatic.net/SMkkb.jpg
When the AJAX event is triggered: https://i.sstatic.net/3N9lg.jpg
I've tried making sure it's not a hasLayout issue and I even tried JavaScript "correcting" the style of the element on certain events BUT in both cases, IE thinks the "right" value is "5px".
Any ideas what the problem here might be?!
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论