I created a jQuery plugin for practice and because I thought it would be a fairly good idea. Headerlinks dynamically and automatically (and quickly) creates an organized table-of-contents list anywhere you want on the page in any style.
The headerlinks plugin (if you are using JS) is what is making the nice table-of-contents block at the top of this page.
The jQuery headerlinks plugin was designed to simplify and automate table-of-contents based on webpage hierarchy.
- jQuery 1.3+
http://explosion-pills.com/development/jquery/plugins/headerlinks/#headerlinks_ident2
Include jQuery. Any time after that, include this script as you would any other script file. You can then use $("#table-of-contents-conatiner").headerlinks();
at will.
- Use a four space soft tab for indentation.
- Write
if (
,for (
, andfunction (
as opposed toif(
,for(
,function(