<header id="mainHeader" class="sticky-header">
<div class="logo">Brand</div>
<nav>
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</nav>
</header>
<main class="content">
<h1>Scroll Down</h1>
<p>The header will disappear to give you more reading space.</p>
<p>Scroll back up to see it return.</p>
<!-- Spacer for scrolling -->
<div style="height: 1500px"></div>
</main>
Back to Snippets
Auto-Hiding Sticky Header JS
Maximize screen space for your users with this smart navigation bar. The header slides out of view when scrolling down to let them focus on content, yet it reappears instantly when they scroll up.
383