Skip to main content

TOC automatica

Documentazione e esempi del componente ‘autotoc’, originale di AUSL-BO

Una componente per la generazione della TOC (Table of Contents) di un nodo html che contiene del testo

Esempio base

Cat O'Nine Tails

...

The Brig

...

Privateer

...

Ahoy

...

<div class="link-list-wrapper border float-right p-2" data-toc>
</div>


<div data-content>
	<h2>Cat O'Nine Tails</h2>
	<p>...</p>

	<h3 id="the-brig">The Brig</h3>
	<p>...</p>

	<h4>Privateer</h4>
	<p>...</p>

	<h2>Ahoy</h2>
	<p>...</p>
</div>
<script>
	document.addEventListener("DOMContentLoaded", function() {
		tableOfContents('[data-content]', '[data-toc]', {
			levels: 'h2, h3, h4, h5, h6', // The heading levels to generate a table of contents from
			heading: 'Indice dei contenuti', // The heading text for the table of contents list
			headingLevel: 'h3', // The level to use for the heading for the table of contents list
			listType: 'ul' // The list type to use for the table of contents
		});
	});
	
</script>

Questo sito utilizza cookie tecnici, analytics e di terze parti.
Proseguendo nella navigazione accetti l’utilizzo dei cookie.

Privacy policy