Header die krimpt bij scrollen Nieuw
Volle header die bij scrollen krimpt tot een smalle zwevende balk met alleen logo en afspraakknop, boven een hero met een portret van de fysiotherapeut. Scroll in het demovlak om het te zien.
Zo gebruik je het
- Plak de HTML op de plek waar het onderdeel moet komen.
- Zet de CSS in je stylesheet. Alle klassen hebben een eigen voorvoegsel, dus niets botst met je eigen opmaak.
- Voeg de JavaScript toe en roep init() aan met het element waar de HTML in staat.
<!-- Header die krimpt bij scrollen · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<div class="jouw-container">
<div class="nsp">
<div class="nsp__scroll" tabindex="0" aria-label="Demovlak, scroll om de header te zien krimpen">
<div class="nsp__head" role="navigation" aria-label="Hoofdmenu">
<div class="nsp__inner">
<a href="#" class="nsp__logo">FysioPunt<span class="nsp__city">Leiden</span></a>
<ul class="nsp__links">
<li><a href="#">Behandelingen</a></li>
<li><a href="#">Sportfysiotherapie</a></li>
<li><a href="#">Ons team</a></li>
<li><a href="#">Vergoeding</a></li>
</ul>
<a href="#" class="nsp__cta">Afspraak maken</a>
<button class="nsp__burger" type="button" aria-expanded="false" aria-controls="nsp-menu" aria-label="Menu openen"><span></span><span></span></button>
</div>
<div class="nsp__menu" id="nsp-menu" aria-hidden="true">
<a href="#">Behandelingen</a><a href="#">Sportfysiotherapie</a><a href="#">Ons team</a><a href="#">Vergoeding</a>
</div>
</div>
<div class="nsp__hero">
<div class="nsp__txt">
<p class="nsp__title">"Binnen drie werkdagen lig je bij mij op de tafel."</p>
<p class="nsp__who">Femke de Vries, fysiotherapeut in Leiden Noord</p>
<p class="nsp__lead">Je hebt geen verwijzing nodig. We werken met alle zorgverzekeraars en zeggen vooraf hoeveel behandelingen je vergoed krijgt.</p>
<p class="nsp__hint">Scroll in dit vlak en kijk naar de header.</p>
</div>
<div class="nsp__duo"><img src="https://neddev.com/lab-media/nav-shrink-pill-1.webp" alt="Portret van fysiotherapeut Femke in de behandelkamer"></div>
</div>
<div class="nsp__more">
<div class="nsp__duo nsp__duo--wide"><img src="https://neddev.com/lab-media/nav-shrink-pill-2.webp" alt="Kniebehandeling met een weerstandsband"></div>
<ul class="nsp__list">
<li><b>Rugklachten</b><span>gemiddeld 6 behandelingen, met een oefenschema voor thuis</span></li>
<li><b>Knie en enkel</b><span>revalidatie na een blessure of operatie, ook voor hardlopers</span></li>
<li><b>Nek en schouder</b><span>bij klachten door beeldschermwerk en spanning</span></li>
<li><b>Bekkenfysiotherapie</b><span>tijdens en na de zwangerschap, in een aparte ruimte</span></li>
<li><b>Fysiofitness</b><span>begeleid trainen in kleine groepen, € 39 per maand</span></li>
</ul>
</div>
<div class="nsp__band"><p class="nsp__bandh">Vergoeding in 2026</p><p>Met een aanvullende verzekering krijg je meestal 9 tot 18 behandelingen vergoed. Wij zoeken het voor je uit voordat je begint.</p></div>
</div>
</div>
</div>/* Header die krimpt bij scrollen · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
/* fonts (Fontshare): synonym@400,600 */
.nsp{position:relative;width:100%;align-self:flex-start;flex:none;height:540px;background:#1D3FD6;color:#FFFFFF;font-family:'Synonym',sans-serif;font-weight:400;overflow:hidden;box-sizing:border-box}
.nsp *{box-sizing:border-box}
.nsp__scroll{height:100%;overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth;outline:none}
.nsp__scroll:focus-visible{outline:2px solid #FFD23F;outline-offset:-2px}
.nsp__head{position:sticky;top:0;z-index:3;padding:0;transition:padding .2s ease}
.nsp__inner{display:flex;align-items:center;gap:24px;max-width:2000px;margin:0 auto;padding:16px 32px;background:#1D3FD6;color:#FFFFFF;border-bottom:1px solid #4D68E6;border-radius:4px;transition:max-width .2s ease,padding .2s ease,background .2s ease,color .2s ease}
.nsp__logo{display:flex;align-items:baseline;gap:8px;font-weight:600;font-size:20px;color:inherit;text-decoration:none;white-space:nowrap;padding:6px 0}
.nsp__city{font-weight:400;font-size:16px;opacity:.8}
.nsp__links{list-style:none;display:flex;gap:24px;margin:0 auto;padding:0;overflow:hidden;max-width:700px;opacity:1;transition:opacity .18s ease}
.nsp__links a{display:inline-block;font-size:16px;color:#FFFFFF;text-decoration:none;white-space:nowrap;padding:8px 0}
.nsp__links a:hover,.nsp__links a:focus-visible{text-decoration:underline;text-underline-offset:5px}
.nsp__cta{margin-left:auto;background:#FFD23F;color:#000;font-weight:600;font-size:15px;padding:12px 18px;border-radius:4px;text-decoration:none;white-space:nowrap;transition:background .18s ease}
.nsp__cta:hover,.nsp__cta:focus-visible{background:#FFFFFF}
.nsp__burger{display:none;flex:none;width:44px;height:44px;border:1px solid currentColor;border-radius:4px;background:transparent;color:inherit;cursor:pointer;position:relative;padding:0}
.nsp__burger span{position:absolute;left:12px;right:12px;height:2px;background:currentColor;transition:transform .2s ease}
.nsp__burger span:first-child{top:17px}.nsp__burger span:last-child{top:25px}
.nsp.is-open .nsp__burger span:first-child{transform:translateY(4px) rotate(45deg)}
.nsp.is-open .nsp__burger span:last-child{transform:translateY(-4px) rotate(-45deg)}
.nsp__menu{display:none;margin:0 auto;max-width:2000px;background:#FFFFFF;padding:8px 20px 16px;border-radius:0 0 4px 4px}
.nsp__menu a{display:block;padding:12px 0;border-bottom:1px solid #DCE3FF;color:#1D3FD6;font-weight:600;font-size:20px;text-decoration:none}
.nsp.is-small .nsp__head{padding:12px 16px 0}
.nsp.is-small .nsp__inner{max-width:420px;gap:12px;padding:8px 8px 8px 18px;background:#FFFFFF;color:#1D3FD6;border-bottom-color:transparent;box-shadow:0 12px 28px -14px rgba(0,0,0,.6)}
.nsp.is-small .nsp__links{max-width:0;opacity:0;margin:0;visibility:hidden}
.nsp__hero{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:40px;align-items:stretch;padding:0 0 0 32px;min-height:440px}
.nsp__txt{align-self:center;padding:48px 0}
.nsp__title{font-weight:600;font-size:clamp(30px,4vw,52px);line-height:1.05;letter-spacing:-.01em;margin:0 0 16px;max-width:17ch}
.nsp__who{font-size:16px;margin:0 0 20px;color:#DCE3FF}
.nsp__lead{font-size:17px;line-height:1.55;max-width:46ch;margin:0;color:#DCE3FF}
.nsp__hint{margin:28px 0 0;font-size:14px;color:#FFD23F}
.nsp__duo{position:relative;background:#DCE3FF;overflow:hidden;min-height:320px}
.nsp__duo img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 20%;filter:grayscale(1) contrast(1.15);mix-blend-mode:multiply}
.nsp__duo::after{content:'';position:absolute;inset:0;background:#1D3FD6;mix-blend-mode:lighten}
.nsp__more{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:40px;padding:56px 32px;align-items:center}
.nsp__duo--wide{min-height:300px;border-radius:4px}
.nsp__list{list-style:none;margin:0;padding:0}
.nsp__list li{display:flex;flex-wrap:wrap;gap:4px 14px;align-items:baseline;padding:14px 0;border-top:1px solid #4D68E6}
.nsp__list li:last-child{border-bottom:1px solid #4D68E6}
.nsp__list b{font-weight:600;font-size:20px}
.nsp__list span{font-size:15px;color:#DCE3FF}
.nsp__band{margin:0 32px 40px;background:#FFD23F;color:#000;border-radius:4px;padding:32px;display:flex;flex-direction:column;justify-content:flex-end;min-height:180px}
.nsp__bandh{font-weight:600;font-size:28px;margin:0 0 8px}
.nsp__band p{margin:0;font-size:16px;line-height:1.55;max-width:56ch}
@media(max-width:760px){
.nsp__inner{padding:12px 20px;gap:10px}
.nsp__logo{font-size:18px}
.nsp__links{display:none}
.nsp__city{display:none}
.nsp__cta{padding:11px 14px;font-size:14px}
.nsp__burger{display:block}
.nsp.is-open .nsp__menu{display:block}
.nsp.is-small .nsp__menu{max-width:100%}
.nsp.is-small .nsp__head{padding:10px 10px 0}
.nsp.is-small .nsp__inner{max-width:100%;padding:6px 6px 6px 14px}
.nsp__hero{grid-template-columns:1fr;padding:0;gap:0}
.nsp__txt{padding:32px 20px}
.nsp__duo{min-height:300px}
.nsp__more{grid-template-columns:1fr;padding:32px 20px;gap:24px}
.nsp__duo--wide{min-height:200px}
.nsp__band{margin:0 20px 28px;padding:24px}}
@media(prefers-reduced-motion:reduce){.nsp__inner,.nsp__head,.nsp__links,.nsp__cta,.nsp__burger span{transition:none}.nsp__scroll{scroll-behavior:auto}}// Header die krimpt bij scrollen · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie
// root = het element waarin de HTML staat
function init(root){
var w=root.querySelector('.nsp');if(!w)return;
var s=w.querySelector('.nsp__scroll');
var bt=w.querySelector('.nsp__burger'),mn=w.querySelector('.nsp__menu');
function on(){w.classList.toggle('is-small',s.scrollTop>48);}
function set(o){w.classList.toggle('is-open',o);bt.setAttribute('aria-expanded',o?'true':'false');bt.setAttribute('aria-label',o?'Menu sluiten':'Menu openen');mn.setAttribute('aria-hidden',o?'false':'true');}
bt.addEventListener('click',function(){set(!w.classList.contains('is-open'));});
mn.addEventListener('click',function(e){if(e.target.closest('a'))set(false);});
w.addEventListener('keydown',function(e){if(e.key==='Escape'&&w.classList.contains('is-open')){set(false);bt.focus();}});
s.addEventListener('scroll',on,{passive:true});on();
w.addEventListener('click',function(e){var a=e.target.closest('a[href="#"]');if(a)e.preventDefault();});
}
init(document.querySelector('.jouw-container'));
Meer uit paginasecties
Iets gezien dat je mooi vindt?
Zet het in je selectie en stuur hem op. Dan bouwen we je site eromheen, in jouw huisstijl.
Neem contact op →
