PDA

View Full Version : Help with "Jump to"



AnGeLiC
06-20-2006, 09:56 PM
I saw the "Jump to top" script on the site. But, I was wondering if there was a "jump to" for a particular spot on the page itself? Rather than just the top. What I have is a newsletter, and I would like to put links at the top for things like "music" which, when clicked, would automatically jump to the music section. Etc. Can anyone help me with this?

Twey
06-20-2006, 09:56 PM
FISH.

AnGeLiC
06-20-2006, 10:02 PM
The code I was referring to isn't the one I needed. >.< So, I don't need help with "that" one.

AnGeLiC
06-20-2006, 10:19 PM
I figured this out. >.< Sorry for the bother. But, for anyone else that's wondering....

For the links at the top of the page:


<p>
<a href="#music">Featured Music.</a>
</p>


Put this where you want that link to jump to on the page:


<a name="music">*content*</a>

mwinter
06-20-2006, 11:30 PM
For the links at the top of the page:



<p>
<a href="#music">Featured Music.</a>
</p>
What you're referring to here is a source anchor; one anchor in a pair that points from one location (the source) to another (the destination). That destination can either be found in the same document, or a different one. As you've discovered, a fragment identifier (#fragment-id) designates a particular location within a document.


Put this where you want that link to jump to on the page:



<a name="music">*content*</a>
This is the destination anchor, and there are in fact two ways to specify one. An anchor (a) element with a name attribute acts as a destination anchor, where the value of that attribute would match against the fragment identifier. This, however, is an increasingly less common approach. In its place, one can add an id attribute directly to the destination element, which adds a lot more flexibility. For example, the above could be replaced with



<p id="music">*content*</p>
Mike


To include markup, it's best to use [html&#93;...[/html&#93; rather than [quote&#93;...[/quote&#93;. The former retains formatting, which can greatly aid readability for large sections of code. There are similar tags for miscellaneous code like CSS or scripts ([code&#93;...[/code&#93;) and PHP code ([php&#93;...[/php&#93;).

mitrm
05-16-2007, 01:01 AM
thanks a lot for the info, this is exactly what I have been looking for! :]

ian