Get started with jquery.tocify CDN

MIT licensed

JQuery.tocify: Lightweight plugin generates TOC from HTML headings.

Tags:
  • jquery
  • toc
  • table of contents

Stable version

Copied!

How to start using jquery.tocify CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with jquery.tocify CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <link rel="stylesheet" href="styles.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.cdnhub.io/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script>
    <script src="script.js"></script>
</head>
<body>
    <button id="generate-toc">Generate Table of Contents</button>
    <div id="content">
        <h2 id="section1">Section 1</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nisi quis scelerisque bibendum, quam turpis euismod mauris, ut rhoncus lorem nibh eget mauris.</p>
        <h2 id="section2">Section 2</h2>
        <p>Donec bibendum scelerisque ante vitae facilisis. Cras porttitor metus justo, ut fringilla urna rhoncus et.</p>
        <h3 id="subsection1">Subsection 1</h3>
        <p>Nullam quis ante. Etiam sit amet orci eget ipsum lacinia bibendum. Nullam quis ante.</p>
        <h3 id="subsection2">Subsection 2</h3>
        <p>Nullam quis ante. Etiam sit amet orci eget ipsum lacinia bibendum. Nullam quis ante.</p>
    </div>
</body>
</html>
Copied!
Copied!
Copied!
Copied!

All versions