Question

I would like to know how to scroll to a <section> element on my page when cliking on an <a> element, both placed in the same page.

Thank you all in advance. Cheers.

Was it helpful?

Solution 3

ScrollIt.js can help you in this regard.

http://bytemuse.com/scrollIt.js/

4 simple steps and you're done

OTHER TIPS

This is a native and easier way to do this. You just have to give id to your section (or any HTML element) in the href attribute of the ancher tag.

Sample snippet:

<a href="#sectionId">GO to section</a>

<section id="sectionId">

//your code

</section>

The W3C Standard

You can do it (in pure HTML) putting hashes in your anchor tags as described on this question: hash in anchor tags

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top