【发布时间】:2020-05-15 17:28:17
【问题描述】:
我有一个包含此内容的菜单:
<div class="menu">
<ol>
<li data-target="home" ><a href="#home">hello</a></li>
<li data-target="contact" ><a href="#contact">Contact</a></li>
<li data-target="policy_privacy" ><a href="https://somesite.com/privacy_policy">Privacy</a></li>
</ol>
</div>
当我在home 页面上时,锚点工作良好(#home,#contact),但如果我在privacy_policy 页面上,并尝试转到主页,则没有任何反应。如果我不在主页(包含锚点)中,如何以某种方式检测并将用户重定向到主页?
【问题讨论】:
标签: html anchor anchor-scroll