Yogesh's Blog

Sharing me with blog…

May 3rd, 2012

Scroll page to specific DOM element

Javascript, by Yogesh.

If looking simple way to scroll a page to specific part of page i.e. specific DOM element, here is the simple way.

Support you have a DOM element like:

<span id="scrollHere"></span>

With window load or specific click on button/link, use following javascript statement:

Syntex:
window.document.hash = "#<d_of_dom_element>";

Example:
window.document.hash = "#scrollHere"

Back Top

Leave a Reply

Your email address will not be published. Required fields are marked *