如何导航到页面的某个部分 [英] How to navigate to a section of a page
本文介绍了如何导航到页面的某个部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有链接的登录页面.如何将用户定向到不同页面的某个部分?
主页:
寿司</a><a href="/sample">烧烤</a>
示例页面:
<div id='bbq'></div>
点击主页中的Sushi"或BBQ"应该将用户导航到页面的id为sushi
或bbq
(分别)的div示例代码>.
没有 JQuery 有可能吗?我不介意使用 JQuery,但使用 html 的更简单的解决方案也可以.
解决方案
使用 HTML 的 锚点:
主页:
寿司</a><a href="sample.html#bbq">烧烤</a>
示例页面:
</a></div><div id='bbq'><a name='bbq'></a></div>I have a landing page with links.
How can I direct user to a section of a different page?
Main Page:
<a href="/sample">Sushi</a>
<a href="/sample">BBQ</a>
Sample Page:
<div id='sushi'></div>
<div id='bbq'></div>
Clicking on "Sushi" or "BBQ" in the Main Page should navigate the user to the div with id sushi
or bbq
(respectively) of the page sample
.
Is it possible without JQuery?
I do not mind using JQuery but a simpler solution using html would work too.
解决方案 Use HTML's anchors:
Main Page:
<a href="sample.html#sushi">Sushi</a>
<a href="sample.html#bbq">BBQ</a>
Sample Page:
<div id='sushi'><a name='sushi'></a></div>
<div id='bbq'><a name='bbq'></a></div>
这篇关于如何导航到页面的某个部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文