如何在进入页面时转到特定锚点(不起作用)
首先,这就是我目前的状态:thsbrk.de。
黑框应该是例如关于部分。我想实现的是,如果您进入我的页面(thsbrk.de),您可以直接转到我的参考部分(锚点“#references”)。然后,如果您点击“关于”链接,您将向上滚动到“关于”部分。我已经尝试让它发挥作用,但没有成功。锚似乎不起作用。
如果有人可以查看我的代码并为我提供解决方案,那就太棒了:)
(滚动尚未实现,我只要求锚点问题)
编辑:这里我有一个示例,它应该如何工作:< a href="http://volll.com/" rel="nofollow">示例
First of all, thats my current state of play: thsbrk.de.
The black boxes should be e.g. a about section. I want to achieve that if you enter my page (thsbrk.de) you directly go to my reference section (anchor '#references'). Then, if you hit the about link you will scroll up to that about section. I already tried to make it working but it doesn't. The anchor seems to be not working.
It would be awesome if someone could look at my code and offer me a solution :)
(The scroll isn't implemented yet, I only ask for the anchor problem)
EDIT: Here I've got a example how it should work: Example
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在头部给出一个像这样的脚本标签。也让它成为第一个脚本。
从你的代码来看,你也做了同样的事情。但只要尝试重新排序可能有效的脚本标签。
Give a script tag like this in the head.Let it be the first script also.
From your code, you have did the same. But just try reordering the script tags it might work.
普通 JS:
这是 2009 年的 jQuery 示例 - 可能有更新的方法
如何使用 jQuery 将表格的一行滚动到视图 (element.scrollintoView) 中?
在您的情况下,这可能有效
Plain JS:
Here is a jQuery example from 2009 - there may be newer ways
How do I scroll a row of a table into view (element.scrollintoView) using jQuery?
In your case this might work
尝试这个并告诉我结果:
然后像这样修改你的锚标记:
Try this and tell me the result:
and then modify your anchor tag like this: