Menuknop wordt kruis
The three bars first slide to the centre and then turn into a cross while the menu slides in from the right; closes with Escape, a click outside or a link.
Elke ochtend om zes uur vers uit de oven.
Achterom 14, Gouda · bestellen kan tot 20:00 voor de volgende dag.
How to use it
- Paste the HTML where the navigation & menus should appear.
- Add the CSS to your stylesheet. All classes are prefixed, so nothing clashes with your own styles.
- Add the JavaScript and call init() with the element that contains the HTML.
<!-- Menuknop wordt kruis · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie -->
<div class="jouw-container">
<div class="hrhx"><div class="hrhx__bar"><a class="hrhx__logo" href="#">Bakkerij Verhoef</a><button class="hrhx__btn" type="button" aria-label="Menu openen" aria-expanded="false"><span class="hrhx__ico" aria-hidden="true"><span class="hrhx__l hrhx__l--a"></span><span class="hrhx__l hrhx__l--b"></span><span class="hrhx__l hrhx__l--c"></span></span></button></div><div class="hrhx__body"><p class="hrhx__kop">Elke ochtend om zes uur vers uit de oven.</p><p class="hrhx__tekst">Achterom 14, Gouda · bestellen kan tot 20:00 voor de volgende dag.</p></div><nav class="hrhx__menu" aria-label="Hoofdmenu"><a class="hrhx__a" href="#">Brood en gebak</a><a class="hrhx__a" href="#">Taarten bestellen</a><a class="hrhx__a" href="#">Openingstijden</a><a class="hrhx__a" href="#">Contact</a></nav></div>
</div>/* Menuknop wordt kruis · © 2026 NedDev BV · NedDev Lab-licentie (gratis gebruik, niet doorverkopen) · neddev.com/nl/lab/gebruik/#licentie */
.hrhx{position:absolute;inset:0;overflow:hidden;background:#f4f3f1;font-family:'Switzer',sans-serif;color:#0a0a0a;container-type:size}
.hrhx__bar{position:relative;z-index:3;display:flex;align-items:center;justify-content:space-between;height:52px;padding:0 10px 0 18px;background:#fff;border-bottom:1px solid rgba(10,10,10,.1)}
.hrhx__logo{display:inline-flex;align-items:center;min-height:44px;font-weight:700;font-size:16px;color:#0a0a0a;text-decoration:none;letter-spacing:-.01em}
.hrhx__btn{width:44px;height:44px;display:grid;place-items:center;background:none;border:0;border-radius:4px;cursor:pointer;color:#0a0a0a;transition:background-color .18s}
.hrhx__btn:hover{background:#f4f3f1}
.hrhx__btn:focus-visible{outline:2px solid #F5480F;outline-offset:1px}
.hrhx__ico{position:relative;width:22px;height:16px;display:block}
.hrhx__l{position:absolute;left:0;width:22px;height:2px;background:currentColor;border-radius:1px;transition:translate .18s ease .18s,rotate .18s ease,opacity .1s ease .18s}
.hrhx__l--a{top:0}.hrhx__l--b{top:7px}.hrhx__l--c{top:14px}
.hrhx.is-open .hrhx__l{transition:translate .18s ease,rotate .18s ease .18s,opacity .1s ease}
.hrhx.is-open .hrhx__l--a{translate:0 7px;rotate:45deg}
.hrhx.is-open .hrhx__l--b{opacity:0}
.hrhx.is-open .hrhx__l--c{translate:0 -7px;rotate:-45deg}
.hrhx__body{padding:7cqh 18px 0;max-width:520px}
.hrhx__kop{margin:0;font-weight:700;font-size:clamp(20px,5.6cqw,44px);line-height:1.05;letter-spacing:-.02em}
.hrhx__tekst{margin:.8em 0 0;font-size:clamp(12px,2.2cqw,16px);line-height:1.4;color:#4a4845}
.hrhx__menu{position:absolute;z-index:2;top:52px;right:0;bottom:0;width:min(260px,72%);display:flex;flex-direction:column;padding:10px 0;background:#0a0a0a;transform:translateX(100%);visibility:hidden;transition:transform .32s cubic-bezier(.3,.7,.2,1),visibility 0s linear .32s}
.hrhx.is-open .hrhx__menu{transform:none;visibility:visible;transition:transform .32s cubic-bezier(.3,.7,.2,1),visibility 0s}
.hrhx__a{display:block;padding:clamp(5px,2.2cqh,12px) 20px;color:#fff;text-decoration:none;font-size:clamp(15px,2.8cqw,20px);font-weight:500;opacity:0;translate:12px 0;transition:opacity .2s,translate .2s,color .15s}
.hrhx.is-open .hrhx__a{opacity:1;translate:0 0}
.hrhx.is-open .hrhx__a:nth-child(2){transition-delay:.04s}.hrhx.is-open .hrhx__a:nth-child(3){transition-delay:.08s}.hrhx.is-open .hrhx__a:nth-child(4){transition-delay:.12s}
.hrhx__a:hover,.hrhx__a:focus-visible{color:#F5480F;outline:none}
@media (prefers-reduced-motion:reduce){.hrhx__l,.hrhx.is-open .hrhx__l,.hrhx__menu,.hrhx.is-open .hrhx__menu,.hrhx__a{transition:none}}// Menuknop wordt kruis · © 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('.hrhx');if(!w)return;
var btn=w.querySelector('.hrhx__btn'),menu=w.querySelector('.hrhx__menu');
var mid='hrhx-m-'+Math.random().toString(36).slice(2,8);menu.id=mid;btn.setAttribute('aria-controls',mid);
function set(open,focusBtn){w.classList.toggle('is-open',open);btn.setAttribute('aria-expanded',open?'true':'false');btn.setAttribute('aria-label',open?'Menu sluiten':'Menu openen');
if(open){var f=menu.querySelector('a');setTimeout(function(){if(w.classList.contains('is-open'))f.focus({preventScroll:true});},60);}else if(focusBtn)btn.focus({preventScroll:true});}
btn.addEventListener('click',function(){set(!w.classList.contains('is-open'),false);});
w.addEventListener('keydown',function(e){if(e.key==='Escape'&&w.classList.contains('is-open')){set(false,true);}});
w.addEventListener('click',function(e){var a=e.target.closest('a');if(a){e.preventDefault();if(menu.contains(a))set(false,true);return;}
if(w.classList.contains('is-open')&&!menu.contains(e.target)&&!btn.contains(e.target))set(false,false);});
}
init(document.querySelector('.jouw-container'));
More navigation & menus
Seen something you like?
Add it to your selection and send it over. We build your site around it, in your brand.
Get in touch →