PDA

View Full Version : Anchor Points



ohchapman
Nov 17th, 2009, 10:55 AM
Please could anyone offer any advice, in simple terms on how to add anchor points to a page in order to create a smooth scroll element such as this one:

http://www.kryogenix.org/code/browser/smoothscroll/#top

Any help would be much appreciated.

Philip M
Nov 17th, 2009, 11:40 AM
If you "View Source" it ought to be clear how you do this.

In essence:-

<h1><a name="top">Smooth scrolling demo</a></h1>

<a href="#p0">Paragraph 0</a>
<a href="#p1">Paragraph 1</a>
<a href="#p2">Paragraph 2</a>
<a href="#p3">Paragraph 3</a>
<a href="#p4">Paragraph 4</a>
<a href="#p5">Paragraph 5</a>
<a href="#p6">Paragraph 6</a>
<!-- and so on ........ -->

<h2><a name="p0">Paragraph 0</a></h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
laoreet. </p>
<p><a href="#top">Back to top</a></p>
<h2><a name="p1">Paragraph 1</a></h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
laoreet. </p>
<p><a href="#top">Back to top</a></p>
<h2><a name="p2">Paragraph 2</a></h2>
<!-- and so on ........ -->


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.