Can anyone help?
What I want to do is generate a table of contents and if it’s longer than 5 items, hide items 6+ behind an accordion. How could I achieve this?
Can anyone help?
What I want to do is generate a table of contents and if it’s longer than 5 items, hide items 6+ behind an accordion. How could I achieve this?
Hey @jaime! There is no native way to do this but you can use custom code with the Attributes API to run code after Table of Contents has successfully loaded with this callback
<script>
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
'toc',
(tableInstances) => {
console.log('table of contents Successfully loaded!');
// Add custom code here!
},
]);
</script>