IE 8 在初始页面加载时不会滚动到片段

发布于 2024-09-13 11:27:11 字数 185 浏览 1 评论 0原文

我在使用 IE 时遇到问题,当页面加载时,它不会滚动到片段(URL 上的 #foo)。片段的锚点是基本 HTML 的一部分,它不是动态的或任何东西。页面相当重。如果我进入地址栏并按 Enter 键,它会按预期滚动到锚点(以及在其他浏览器中观察到的情况)。在 IE 7 和 IE 8 上观察到行为。有人遇到过这个问题并有解决方法吗?

I'm having a problem with IE where it doesn't scroll to a fragment (#foo on the URL) when the page loads. The anchor for the fragment is part of the base HTML, it isn't dynamic or anything. The page is pretty heavy. If I go into the location bar and hit enter, it scrolls to the anchor as expected (and as observed in other browsers). Behavior is observed on IE 7 and IE 8. Anybody run into this and have a workaround?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁把谁当真 2024-09-20 11:27:19

您是否尝试过延迟滚动操作,直到窗口加载事件而不是 DOM 就绪事件?这样,它可以更精确地向下移动并计算它需要去的地方。

演示或一些代码显然有助于调试。

Have you tried delaying the scrolling action until say, the window load event instead of the DOM ready event? That way it might be more precise in shifting downwards and calculating where it needs to go.

A demo or some code would help debugging obviously.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文