Parallax-lagen
Een polderlandschap in vijf lagen die elk met een eigen snelheid bewegen terwijl je in het vlak scrolt: de zon zakt, de dijk en bomen schuiven omhoog; voor een sfeervolle opening of een verhaal in stappen.
Lagen geven diepte
Elke laag beweegt in zijn eigen tempo.
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.
<!-- Parallax-lagen · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<div class="jouw-container">
<div class="h4px">
<div class="h4px__sc" tabindex="0" aria-label="Scrollvlak met een landschap in lagen">
<div class="h4px__track">
<div class="h4px__scene">
<div class="h4px__sky" aria-hidden="true"></div>
<div class="h4px__sun" data-s="0.42" aria-hidden="true"></div>
<h3 class="h4px__t" data-s="0.22">Lagen geven diepte</h3>
<svg class="h4px__l h4px__l--far" data-s="-0.12" viewBox="0 0 800 200" preserveAspectRatio="xMidYMin slice" aria-hidden="true">
<path d="M0 74 Q200 56 400 64 T800 60 L800 200 L0 200Z"/>
<path d="M548 66 L553 26 L567 26 L572 66Z"/>
<g class="h4px__sails"><rect x="558" y="-2" width="4" height="58"/><rect x="532" y="26" width="56" height="4"/></g>
</svg>
<svg class="h4px__l h4px__l--mid" data-s="-0.32" viewBox="0 0 800 200" preserveAspectRatio="xMidYMin slice" aria-hidden="true">
<path d="M0 74 L800 74 L800 200 L0 200Z"/>
<circle cx="40" cy="62" r="22"/><circle cx="78" cy="54" r="28"/><circle cx="118" cy="64" r="18"/><circle cx="210" cy="60" r="24"/><circle cx="246" cy="66" r="16"/>
<path d="M300 74 L300 46 L330 26 L360 46 L360 74Z"/>
<circle cx="430" cy="58" r="26"/><circle cx="470" cy="64" r="20"/><circle cx="610" cy="56" r="30"/><circle cx="652" cy="64" r="20"/><circle cx="740" cy="60" r="24"/><circle cx="780" cy="66" r="18"/>
</svg>
<div class="h4px__l h4px__l--front" data-s="-0.46">
<svg viewBox="0 0 800 60" preserveAspectRatio="none" aria-hidden="true"><path d="M0 40 Q200 18 420 30 T800 26 L800 60 L0 60Z"/></svg>
<p class="h4px__end">Elke laag beweegt in zijn eigen tempo.</p>
</div>
</div>
</div>
</div>
<p class="h4px__hint" aria-hidden="true">Scroll in dit vlak</p>
</div>
</div>/* Parallax-lagen · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
.h4px{position:absolute;inset:0;font-family:'Switzer',sans-serif;overflow:hidden}
.h4px__sc{position:absolute;inset:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin}
.h4px__sc:focus-visible{outline:2px solid #F5480F;outline-offset:-2px}
.h4px__track{height:320%;position:relative}
.h4px__scene{position:sticky;top:0;height:31.25%;overflow:hidden}
.h4px__sky{position:absolute;inset:0;background:linear-gradient(180deg,#f4f3f1 0%,#f8e4d8 62%,#f9d2bd 100%)}
.h4px__sun{position:absolute;left:60%;top:24%;width:clamp(60px,14vw,150px);aspect-ratio:1;border-radius:50%;background:#F5480F;will-change:transform}
.h4px__t{position:absolute;left:7%;top:14%;margin:0;max-width:60%;font-size:clamp(26px,5.4vw,64px);line-height:1;font-weight:700;letter-spacing:-.03em;color:#0a0a0a;will-change:transform}
.h4px__l{position:absolute;left:0;width:100%;display:block;will-change:transform}
.h4px__l--far{bottom:-12%;height:52%;fill:#c9c2b9}
.h4px__l--mid{bottom:-34%;height:62%;fill:#6d655c}
.h4px__l--front{bottom:-78%;height:98%;background:#0a0a0a}
.h4px__l--front svg{position:absolute;left:0;bottom:100%;width:100%;height:28px;fill:#0a0a0a;display:block}
.h4px__sails{transform-box:view-box;transform-origin:560px 28px;animation:h4px-turn 9s linear infinite}
@keyframes h4px-turn{to{transform:rotate(360deg)}}
.h4px__end{position:absolute;left:7%;right:7%;top:30%;margin:0;color:#fff;font-size:clamp(16px,2.6vw,28px);font-weight:600;letter-spacing:-.01em}
.h4px__hint{position:absolute;right:12px;bottom:10px;margin:0;font-size:12px;font-weight:500;color:#fff;pointer-events:none;transition:opacity .3s}
.h4px__hint.is-weg{opacity:0}
.h4px--still .h4px__track{height:100%}
.h4px--still .h4px__scene{height:100%}
.h4px--still .h4px__sails{animation:none}
.h4px--still .h4px__hint{display:none}// Parallax-lagen · © 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('.h4px');if(!w)return;
var sc=w.querySelector('.h4px__sc'),hint=w.querySelector('.h4px__hint');
var layers=[].slice.call(w.querySelectorAll('[data-s]'));
var reduce=matchMedia('(prefers-reduced-motion: reduce)').matches,busy=false;
if(reduce)w.classList.add('h4px--still');
function upd(){
busy=false;
var max=sc.scrollHeight-sc.clientHeight,H=sc.clientHeight;
var p=reduce?0.5:(max>0?sc.scrollTop/max:0);
layers.forEach(function(l){l.style.transform='translate3d(0,'+(p*(+l.getAttribute('data-s'))*H).toFixed(1)+'px,0)';});
hint.classList.toggle('is-weg',sc.scrollTop>8);
}
sc.addEventListener('scroll',function(){if(!busy){busy=true;requestAnimationFrame(upd);}},{passive:true});
if('ResizeObserver' in window)new ResizeObserver(upd).observe(sc);
upd();
}
init(document.querySelector('.jouw-container'));
Meer uit scroll-effecten
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 →