Flexible, nested table of contents

联合创作 · 2023-10-02 14:26

Plugin to add a table of contents to a page using jQuery, featuring:

  • the ability to select via selectors exactly which elements would be included (i.e., #content h2 instead of just h2)
  • the ability to nest the lists of sections to reflect the hierarchy of the page

The following returns an unordered list that you can then add to your page:

$.toc('#content h1, h2, h3.foo');

浏览 2
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报