truthSeekr truthSeekr - 2 years ago 101
HTML Question

How to navigate to a section of a page

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
(respectively) of the page

Is it possible without JQuery?
I do not mind using JQuery but a simpler solution using html would work too.

Answer Source

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>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download