WordPress Table of Contents Plugin (CMTOC) - How To - Automatically Expand and Collapse Chapters in TOC
How To Automatically Expand and Collapse Chapters in TOC
Note: the feature described in this guide was presented in version 1.6.0.
With the The WordPress Table of Contents plugin it is possible to automatically expand and collapse chapters in TOC while the user scrolls through the relevant chapter in the article. This feature can be applied to either Floating TOC or Sticky Widget.
TIP
Learn more about how to configure Floating TOC and Sticky Widget:
Enabling the Feature
To enable the feature, navigate to Admin Dashboard → CM Table of Contents Pro → Settings → Table of Contents tab.

Under the General Settings section, enable the option Auto expand/collapse sub-chapters, then save the settings.

Front-end Examples
Auto expanding and collapsing work a bit differently for Sticky Widget and Floating TOC.
Sticky Widget - in this case it expands and collapses only current sub-chapters of currently viewed chapter or sub-chapter:

Floating TOC - in this case it expands all sub-chapters of the main chapter:

![]() |
More information about the WordPress Table of Contents Plugin Other WordPress products can be found at CreativeMinds WordPress Store |
![]() |
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |