jQuery scrollTop 网站在页面加载时向下跳转一半
我正在为自己设计一个新的在线作品集,到目前为止一切都进展顺利。它是一个 HTML5 文件,分为单独的“文章”,每个文章都包含一项技能,用户可以通过 链接进行导航。为了解决这个问题,我使用了两块 jQuery,一块适用于 IE,另一块适用于其他所有内容。 ;-)
然而,今天稍微摆弄之后,我遇到了一个奇怪的错误,一旦页面加载,它似乎跳到一半左右。在 Google Chrome 中,它会突然返回到顶部,但在 Firefox 4 和 Internet Explorer 8 中,它会保持原状,远离页面的预期来源。
请亲自查看:我的在线作品集。
今天早上我所做的就是调整 CSS,我已将其隔离为不是问题所在。此外,注释掉 HTML 文件的第 216-27 行以删除页面滚动插件也无法解决问题。
但是,删除对主 jQuery 库的引用(,第 202 行)确实会删除跳跃错误...以及所有其他基于 jQuery 的页面功能!当当!
有什么好主意吗?我已经快要完成这个网站了,现在我正在抓狂,这样一个愚蠢的错误似乎挡住了它的路。
I'm in the process of designing a new online portfolio for myself and thus far all had been going pretty smoothly. It's a single HTML5 file broken into separate 'articles', each of which contains a skill, through which the user navigates via <a href="#target">
links. To smooth this out, I've used two chunks of jQuery, one that works in IE and one for everything else. ;-)
However, after only a little fiddling around today I've encountered a strange bug whereby once the page has loaded, it appears to jump to around halfway down. In Google Chrome it then jerkily returns to the top, but in Firefox 4 and Internet Explorer 8 it stays put, nowhere near the page's intended origin.
Please take a look for yourself at: my online portfolio to be.
All I had been doing this morning was adjusting CSS, which I have isolated as not being the issue. What's more, commenting out lines 216–27 of the HTML file to remove the page scrolling plugins also fails to resolve the issue.
However, removing the reference to the main jQuery library (<script src="js/jquery-1.5.2.min.js"></script>
, line 202) does remove the jumping bug... as well as all of the other jQuery-based page functionality! Dang!
Any bright ideas? I was pretty close to completing the site and am tearing my hair out now such a silly bug seems to be standing in its way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(评论中回答了问题。已转换为社区 wiki 帖子。请参阅 问题没有答案,但问题在评论中解决(或在聊天中扩展))
OP 写道:
@drudge 写道:
OP 写道:
(Question answered in the comments. Converted to a community wiki post. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
@drudge wrote:
The OP wrote: