2016-06-10 35 views
-5

我正在寻找一个jQuery或任何你需要做到这一点:当你点击某个类别,'#{类别}'被添加到该网址,它跳到希望的部分。这个怎么用?点击.a并跳到网站的某个部分

+2

转到[这里] (http://www.w3schools.com/html/html_links.asp)并导航至**创建书签**部分 – nem035

回答

1

你需要的是锚。

你需要在你的页面与一个特定ID的项目某处定义,例如

<h2 id="my_custom_id">This is a title but it can be anything else</h2>

那么你作出这样的链接:

<a href="#my_custom_id">Anchor example</a>

+0

非常感谢! –

相关问题