Table of Contents jQuery Plugin
This is just a short Friday post to announce a new jQuery plugin for you to use, fork and adapt for your projects! This plugin takes either a part of a web page, or the entire page, and builds a table of contents based on the H1 through H6 tags. Additionally, it can add “Top” links to the headers, be styled as nested <ol> or <ul> list, be styled as a straight list of links, and it even supports a proportionate spacing style that matches the actual distance between the headers.
All this was inspired yesterday by Janko’s article yesterday, “Automatically generate table of contents using jQuery.” Start by reading his article to get a background on the topic, then head over to the documentation page for the download link as well as three different examples of usage.
This plugin is version 0.8, so please comment on any bugs you find. Feel free to follow or fork the project on github as well! Keep in mind I didn’t spend ages getting the CSS on the example pages to be cross-browser ready, though the plugin itself has full cross-browser support.
Doug Neiner is an Editor at Fuel Your Coding and an official member of the jQuery Team. He is addicted to new technology, and specifically loves spending time with WordPress, Ruby on Rails and jQuery. Learn more via twitter or his Google Profile.




This plugin is amazing. Highly customizable, easy to use, perfect all around. It is great!
Glad to see you liked the tut. The plugin is really great!
I also wrote a pretty nice JS TOC plugin. It adds targets in your code based on the heading information, generates an optional TOC and pretty flexible.
Check it out on Github: http://github.com/newism/nsm.toc.jquery_plugin/tree/master
Very nice. Would be cool if you can add scrolling animation when clicking the navigation.
Github’s version is also very nice. I like the addition of the [top] links and header numbers (like on Wikipedia).
Used it in my documentation for a GraphicRiver product.