[thelist] Scrolling heirmenus and internal links

George Dillon - WoW Evolt! evolt at georgedillon.com
Fri Oct 26 07:11:07 CDT 2001


I'm in the process of adding a dynamic hierarchical menu to my site and want
the masthead (of which it is a part) to be always visible at the top of the
browser window (done using a looping function).

Its working but it now my internal links (e.g. <a href="#targetonthispage">)
are a problem, since when the '#' link is clicked, the document jumps to
the anchor (as normal) and then the masthead drops into place and obscures
the
top of the page (where the anchor is).

I *could* solve the problem by adding an onclick function to all my # links,
thusly:

  function scrollHash() { hashUp=setTimeout("scrollBy(0,-120)",200)}

  <a href="#targetonthispage" onclick="scrollHash()">

but obviously I'd rather not have to change numerous existing links and then
have to remember to add this code into all new internal links (and besides
this will only work on the page and not if the page is opened with a hash in
the URL).

Is there a simpler solution?

TIA

George Dillon









More information about the thelist mailing list