🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

jToc is a tiny jQuery table of contents plugin which automatically generate a page navigation with anchors and IDs for all of the heading elements in the document.

Table-of-Contents

Documentation

jToc - jQuery/Jeremy's Table of Contents

Builds a table of contents based on headings on the page.

Usage

Call on a ul/ol and it will get populated with TOC links.

Example

$('ul.toc').jtoc({content: '.content', headings: 'h2,h3'}); 

Options

  • content: The selector to search for headings in. Default: 'body'
  • headings: Headings to search for. Default: "h1,h2,h3"
  • anchorPrefix: Optionally add a prefix to anchors.
  • scrollEnabled: Should there be smooth scrolling to headings. Default true
  • scrollSpeed: Speed of animation when scrolling to headings. Default 400
  • scrollEase: Scroll animation. Default: 'swing'
  • scrollEl: The element that scrolls. Default: 'body,html'
  • scrollOffset: A pixel offset for scroll. Default 0

Credits/Authors

Full credit goes to original authors here:

I simply merged functionality from all of these projects, refactored a bit and added a few extra features.


You May Also Like