Generate a table of contents for specific page content using javascript.
Usage
You need to install the following jQuery plugins in your sites/all/libraries folder:
- jQuery.scrollTo: https://github.com/flesler/jquery.scrollTo
- jQuery.localScroll https://github.com/flesler/jquery.localScroll
- TableOfContents https://github.com/dcneiner/TableOfContents
Make sure this is the folder structure you end up with:
{Libraries}/jquery.tableofcontents/jquery.tableofcontents.min.js
{Libraries}/jquery.scrollTo/jquery.scrollTo.min.js
{Libraries}/jquery.localScroll/jquery.localScroll.min.js
Visit admin/config/user-interface/toc to configure the module's behavior and enable content types.
Visit the content types "manage fields" tab to place the "Enable Table Of Contents" fieldset.
Optionally, a jquery selector for the destination field can be added. That way you can place the TOC anywhere you want (e.g. a custom block, panel, region, ...)
Sponsored
Development of this module was brought to you by Coworks Drupal Team.
The author may be contacted for custom development.
History
This is based on a Drupal 6 module posted in this blog post on drupalcoder.
Apart from the general changes that were needed for Drupal 7 compatibility, I made some other changes:
Instead of using the "Smooth Anchors jQuery plugin" which doesn't seem to be actively maintained, I've opted for the jQuery.scrollTo plugin (with localScroll extension).
Also, the TOC placement can be controlled on the manage fields section of the content type.
Alternatives
The following modules offer comparable or similar functionality, but without using client side jquery:
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Content editing experience, Content display, Developer tools
22 sites report using this module
- Created by rv0 on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.


