Floating Side Navigation
A floating side navigation to quickly browse through different sections of the page.
Projects /
A floating side navigation to quickly browse through different sections of the page.
This fixed side navigation is used to provide an overview of the page content and ease the navigation through the page.
It is composed of links to different sections on the same page. To connect each navigation link to the appropriate section, make sure the href value of the link is equal to the ID of the target section.
The component becomes visible past the 'medium' breakpoint. On smaller devices, the navigation visibility can be changed using a trigger element (e.g., button).
To connect the navigation to its trigger, make sure the id value of the first one is equal to the aria-controls value of the second one. The trigger element in the demo is hidden past the 'medium' breakpoint (using the hide@md
visibility class).
Important: the section containing the elements the navigation links to should have a .js-float-sidenav-target
class. When this element is inside the viewport, the .float-sidenav--on-target
class is added to the .float-sidenav
element. This class can be used to change the style of the navigation when its target is inside the viewport (e.g., you could hide the navigation until the .js-float-sidenav-target
is visible).
<div id="float-sidenav-id" class="float-sidenav js-float-sidenav">
<!-- side navigation -->
</div>
<div class="js-float-sidenav-target">
<!-- navigation targets -->
</div>