I want the toc to be initially all unfolded without any animation effects. #1616
-
Checklist
How did you create the site?Built from DescriptionCurrently, toc is unfolded and sub-items appear only when the corresponding part is being read. Operations you have already triedI don't know.. Anything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
It's a good question and this is doable. Create a file export function toc() {
if (document.querySelector('main h2, main h3')) {
// see: https://github.com/tscanlin/tocbot#usage
tocbot.init({
tocSelector: '#toc',
contentSelector: '.content',
ignoreSelector: '[data-toc-skip]',
headingSelector: 'h2, h3, h4',
orderedList: false,
scrollSmooth: false,
collapseDepth: 6,
});
}
}
// How many heading levels should not be collapsed.
// For example, number 6 will show everything since
// there are only 6 heading levels and number 0 will collapse them all.
// The sections that are hidden will open
// and close as you scroll to headings within them.
collapseDepth: 0, There are many more settings available, check them out here. |
Beta Was this translation helpful? Give feedback.
-
@kungfux Oh.. It is really awesome!! Thank you for your reply 😀 This is exactly what I wanted. Thank you so much!!! |
Beta Was this translation helpful? Give feedback.
It's a good question and this is doable.
Create a file
_javascript\modules\components\toc.js
with the following content to override default TOC bot configuration:collapseDepth
is the setting you are looking for: