最近搜索
没有最近搜索
Create a Table of Contents automatically
已于 2016年8月18日 发布
Much like the author of this article, our company needs a way to automatically generate a table of contents for large articles. After finding out we can use jQuery, I put together a script that will automagically create a tiered table of contents based on the Header tags used in the article.
All you need to do is paste the Javascript in this page into the Javascript section of your Articles:
Click on the JS tab, then paste in the code at the end:
That should do it.. as long as you've used proper heading tags (H1, H2, etc), a Table of Contents will be created any time you load the article.
You can see a live example here: http://codepen.io/ngalluzzo/pen/kXqyVQ?editors=1010
3
55
55 条评论
Nic Galluzzo
Iggy, could you send me a codepen with the HTML you're using? Happy to review that for you.
0
Ziv Bass Specktor
That's a great tip, but it doesn't work :-(
First, the ".appendTo($wrapper);" line gives a syntax error. What should be here before the '.appendTo'?
Second, the code doesn't seem to be called at all. How should it be activated?
Third, isn't ZenDesk responsible for checking and publishing these kind of tips? TOC is a basic feature in most platforms, so at least ZenDesk should guide users on how to do this as the ZD Guide doesn't provide it.
0
Iggy Pritzker
Doesn't work when having more HTML elements between them :(
0
Andrew J
Awesome tip Nicolas!
0
Jennifer Rowe
ooooh, a lot of users will love this. Thanks for sharing this tip, Nicolas!
0
登录 to leave a comment.