-
Hamburger Navigation Menu
HTML
CSS
JavaScript
Home
Play Game
Leaderboard
Settings
🚀 Neon Block Breaker
Tap to start your game
body { margin: 0; font-family: 'Segoe UI', sans-serif; background: #0a0a0a; overflow-x: hidden; } /* 🔹 Hamburger */ .hamburger { position: fixed; top: 20px; left: 20px; width: 40px; height: 30px; cursor: pointer; z-index: 4; } .hamburger span { display: block; height: 4px; margin: 6px 0; border-radius: 5px; background: linear-gradient(90deg, #00f7ff, #ff00e0); box-shadow: 0 0 10px #00f7ff, 0 0 20px #ff00e0; transition: 0.4s; } /* 🔹 Morph Animation */ .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); } .hamburger.active span:nth-child(2) { opacity: 0; } .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); } /* 🔹 Hover Glow */ .hamburger:hover span { box-shadow: 0 0 20px #00f7ff, 0 0 40px #ff00e0; } /* 🔹 Menu */ .menu { position: fixed; top: 0; left: -280px; width: 260px; height: 100%; padding-top: 80px; backdrop-filter: blur(12px); background: rgba(20, 20, 20, 0.65); border-right: 1px solid rgba(255, 255, 255, 0.1); transition: 0.5s cubic-bezier(0.77, 0, 0.18, 1); z-index: 3; } .menu.show { left: 0; } /* 🔹 Menu Links */ .menu a { display: block; padding: 15px 25px; color: #fff; text-decoration: none; font-size: 18px; transition: 0.3s; position: relative; } .menu a:hover { color: #00f7ff; text-shadow: 0 0 8px #00f7ff, 0 0 20px #ff00e0; transform: translateX(10px); } .menu a::after { content: ''; position: absolute; left: 0; bottom: 5px; width: 0%; height: 2px; background: linear-gradient(90deg, #00f7ff, #ff00e0); transition: 0.3s; } .menu a:hover::after { width: 80%; } /* 🔹 Overlay (BEHIND content) */ .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; opacity: 0; z-index: 1; transition: 0.3s; } .overlay.show { opacity: 0.5; } /* 🔹 Content */ .content { position: relative; z-index: 2; padding: 120px 20px; text-align: center; color: white; transition: 0.4s ease; } /* 🔹 Content Animation */ .content.active { transform: scale(0.95) translateX(140px); filter: blur(2px); opacity: 0.7; } /* 🔹 Fancy Title */ .content h1 { font-size: 42px; background: linear-gradient(90deg, #00f7ff, #ff00e0); -webkit-background-clip: text; color: transparent; text-shadow: 0 0 20px rgba(255, 255, 255, 0.2); } .content p { font-size: 18px; opacity: 0.8; } /* 🔹 Responsive */ @media (max-width: 600px) { .content.active { transform: scale(0.95) translateX(100px); } .menu { width: 220px; } }
const hamburger = document.getElementById("hamburger"); const menu = document.getElementById("menu"); const overlay = document.getElementById("overlay"); const content = document.getElementById("content"); hamburger.onclick = () => { hamburger.classList.toggle("active"); menu.classList.toggle("show"); overlay.classList.toggle("show"); content.classList.toggle("active"); }; overlay.onclick = () => { hamburger.classList.remove("active"); menu.classList.remove("show"); overlay.classList.remove("show"); content.classList.remove("active"); };
Live Preview