Javascript Tricks, Samples, Tutorials & Howtos

New versions notifications available via

Follow jtricksdotcom on Twitter
/ / Automatic Generators / AutoAnchor Menu
Last updated: 21 Sep 2012

AutoAnchor Menu

While the web represents infinite canvas to present information, long chunks of information have to be split somehow, otherwise information reading will become unwieldly. Scrolling 30 screens of a textual document to find some specific information doesn't represent big improvements over printed books.

Then you split it into pages losing the ability to print the long article as a whole and browser's search box becoming less useful.

Menu with hyperlinks to anchors located throughout the page is a great alternative to splitting long articles. Print and search functionality remains intact while delivering the ability to find the relevant article section without lots of scrolling.

The autonchor script on this page uses scatter-gather concept to build a menu of article sections. First it scatters anchors to header tags (H1..H9) and then gathers hyperlinks to those to create a menu.


  • Hyperlinks to header tags of specified levels;
  • Tree-like or flat for different heade levels;
  • Links to the beginning and to the bottom of the page.
For excellent results combine AutoAnchor menu with some way to keep on screen. For example, use it together with Absolute Floating Menu.

Now what?