feat: add responsive mobile hamburger menu and fix horizontal overflow

This commit is contained in:
2026-09-21 21:33:53 +02:00
parent 25363e90d3
commit 8b98e478bd
4 changed files with 308 additions and 8 deletions
+32 -3
View File
@@ -15,11 +15,19 @@
<a href="index.html" class="logo">
🥨 <span>Waiswuaschd</span>.de
</a>
<nav class="main-nav">
<button class="mobile-toggle" aria-label="Menü öffnen" id="mobileMenuBtn" aria-expanded="false">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</button>
<nav class="main-nav" id="mainNav">
<a href="index.html">Startseite</a>
<a href="index.html#features">Funktionen</a>
<a href="index.html#schritte">So geht's</a>
<a href="index.html#kontakt">Portal anfragen</a>
<a href="impressum.html">Impressum</a>
<a href="datenschutz.html" class="active">Datenschutz</a>
<a href="https://demo.dev.waiswuaschd.de" class="btn btn-outline">Zum Portal</a>
<a href="https://demo.dev.waiswuaschd.de" class="btn btn-outline" target="_blank" rel="noopener">Live-Demo (Schmankerl)</a>
</nav>
</div>
</header>
@@ -84,7 +92,7 @@
<!-- Footer -->
<footer class="site-footer">
<div class="container footer-content">
<p>&copy; 2026 Waiswuaschd.de</p>
<p>&copy; 2026 Waiswuaschd.de – Die Brotzeit-Plattform für Teams.</p>
<div class="footer-links">
<a href="index.html">Startseite</a>
<a href="impressum.html">Impressum</a>
@@ -93,5 +101,26 @@
</div>
</footer>
<script>
const mobileBtn = document.getElementById('mobileMenuBtn');
const mainNav = document.getElementById('mainNav');
if (mobileBtn && mainNav) {
mobileBtn.addEventListener('click', () => {
const isOpen = mainNav.classList.toggle('open');
mobileBtn.classList.toggle('open', isOpen);
mobileBtn.setAttribute('aria-expanded', isOpen);
document.body.style.overflow = isOpen ? 'hidden' : '';
});
mainNav.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
mainNav.classList.remove('open');
mobileBtn.classList.remove('open');
mobileBtn.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
});
});
}
</script>
</body>
</html>