开发者

IE 8 doesn't scroll to fragment on initial page load

开发者 https://www.devze.com 2023-01-10 16:04 出处:网络
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

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 I开发者_JAVA百科E 8. Anybody run into this and have a workaround?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号