Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

scrollto element by id

You can use an anchor to "focus" the div. This will bring the Div to the top of the page
I.e:

<div id="myDiv"></div>
and then use the following javascript:

// the next line is required to work around a bug in WebKit (Chrome / Safari)
location.href = "#";
location.href = "#myDiv";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #scrollto #element #id
ADD COMMENT
Topic
Name
1+7 =