</> ConvertAtlas Developer Tools
Bootstrap 5 · Intermediate

Condensing Scroll Header

A sticky header that shrinks and adds a shadow on scroll.

Requires Bootstrap 5. Add the CDN tags below to your page (styles in <head>, scripts before </body>). The downloaded file already includes them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<div style="max-width:340px"><div class="border rounded-3 overflow-auto" id="ssScroll" style="height:240px">
  <div class="sticky-top bg-white border-bottom px-3 d-flex align-items-center justify-content-between" id="ssHead" style="transition:padding .2s,box-shadow .2s;padding:18px 12px"><b id="ssBrand" style="transition:font-size .2s">Lumen</b><span class="badge text-bg-primary">Pro</span></div>
  <div class="p-3 small text-secondary"><p>Scroll down — the header condenses.</p><div style="height:120px"></div><p>Halfway there…</p><div style="height:120px"></div><p>Bottom reached.</p></div>
</div></div>
var sc=document.getElementById('ssScroll'),h=document.getElementById('ssHead'),brand=document.getElementById('ssBrand');
sc.addEventListener('scroll',function(){var s=sc.scrollTop>20;h.style.padding=s?'8px 12px':'18px 12px';h.style.boxShadow=s?'0 4px 12px rgba(0,0,0,.08)':'none';brand.style.fontSize=s?'1rem':'1.25rem'});
Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.