具有散列片段的锚点未导航到匹配的ID

时间:2016-09-24 07:12:57

标签: html anchor react-router

我有一个带散列片段的锚点:

<a href="#people">People</a>

在我的页面上,我有一个匹配ID的部分:

<section id="people">...</section>

单击链接后,URL会更新,但页面不会移动到该部分。

您可以在这里试用,所有导航项都有哈希片段,页面上的每个部分都有匹配的ID:https://react-test-don.herokuapp.com

为什么点击我的锚标签什么都不做?

1 个答案:

答案 0 :(得分:0)

为此,我使用

<a name="subject"></a> - At the position in the page where I want to go
<a href="#subject">Go to subject</a> For the link to jump there

查看我的页面 - 您应该能够查看来源

Here

只需向下滚动到它所说的位置&#39;在此页面上&#39;有几个链接将您带到页面的不同部分。