Scrollspy
A menu that follows the section in view
Sections
Scroll the text; the menu follows.
Overview
Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.
Links in the menu jump straight to their section.
On a phone the menu sits above the text and slides sideways.
Setup
Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.
Links in the menu jump straight to their section.
On a phone the menu sits above the text and slides sideways.
Usage
Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.
Links in the menu jump straight to their section.
On a phone the menu sits above the text and slides sideways.
Questions
Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.
Links in the menu jump straight to their section.
On a phone the menu sits above the text and slides sideways.
Code
<div class="scrollspy">
<nav class="scrollspy-nav" aria-label="Sections" data-scrollspy>
<a href="#spy-1" aria-current="true">Overview</a><a href="#spy-2">Setup</a><a href="#spy-3">Usage</a><a href="#spy-4">Questions</a>
</nav>
<div class="scrollspy-body" tabindex="0" role="region" aria-label="Sections">
<section id="spy-1" class="spy-section">
<h3>Overview</h3>
<p class="text-label-2">Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.</p>
<p class="text-label-2">Links in the menu jump straight to their section.</p>
<p class="text-label-2">On a phone the menu sits above the text and slides sideways.</p>
</section>
<section id="spy-2" class="spy-section">
<h3>Setup</h3>
<p class="text-label-2">Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.</p>
<p class="text-label-2">Links in the menu jump straight to their section.</p>
<p class="text-label-2">On a phone the menu sits above the text and slides sideways.</p>
</section>
<section id="spy-3" class="spy-section">
<h3>Usage</h3>
<p class="text-label-2">Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.</p>
<p class="text-label-2">Links in the menu jump straight to their section.</p>
<p class="text-label-2">On a phone the menu sits above the text and slides sideways.</p>
</section>
<section id="spy-4" class="spy-section">
<h3>Questions</h3>
<p class="text-label-2">Each section is long enough to scroll. The menu on the left marks the one you are reading, so you always know where you are in a long page.</p>
<p class="text-label-2">Links in the menu jump straight to their section.</p>
<p class="text-label-2">On a phone the menu sits above the text and slides sideways.</p>
</section>
</div>
</div>