Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
<li><a href="#pricing">Pricing</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<div class="hamburger">
<button class="hamburger" aria-label="Toggle navigation" aria-expanded="false">
<span></span>
<span></span>
<span></span>
</div>
</button>
</div>
</nav>

Expand Down
6 changes: 5 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ const navMenu = document.querySelector('.nav-menu');
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
navMenu.classList.toggle('active');
const expanded = navMenu.classList.contains('active');
hamburger.setAttribute('aria-expanded', expanded);

// Prevent body scroll when menu is open
if (navMenu.classList.contains('active')) {
if (expanded) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = '';
Expand All @@ -19,6 +21,7 @@ document.querySelectorAll('.nav-menu a').forEach(link => {
link.addEventListener('click', () => {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
hamburger.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
});
});
Expand All @@ -28,6 +31,7 @@ window.addEventListener('scroll', () => {
if (navMenu.classList.contains('active')) {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
hamburger.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
}
});
Expand Down
34 changes: 31 additions & 3 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
box-sizing: border-box;
}

:root {
--header-h: 80px; /* Default header height for desktop and larger screens */
}

html, body {
width: 100%;
overflow-x: hidden;
Expand Down Expand Up @@ -40,7 +44,8 @@ body {
background: rgba(0, 0, 0, 0.95);
backdrop-filter: blur(10px);
z-index: 1000;
padding: 1.2rem 0;
height: var(--header-h); /* use the shared header height */
padding: calc(env(safe-area-inset-top) + 0.5rem) 0 0.5rem; /* safe-area + some breathing room */
border-bottom: 1px solid #333;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}
Expand Down Expand Up @@ -143,6 +148,8 @@ body {
padding: 0.5rem;
border-radius: 6px;
transition: all 0.3s ease;
border: none;
background: transparent;
}

.hamburger:hover {
Expand Down Expand Up @@ -175,7 +182,7 @@ body {
min-height: 100vh;
display: flex;
align-items: center;
padding-top: 80px;
padding-top: var(--header-h);
background: #000000;
position: relative;
}
Expand Down Expand Up @@ -837,8 +844,29 @@ body {

/* Responsive Design */
@media (max-width: 768px) {
/* Override the shared header height for small screens */
:root {
--header-h: 60px;
}

/* compact horizontal logo */
.nav-logo {
flex-direction: row;
align-items: center;
gap: .5rem;
}

/* tighten flex spacing to avoid horizontal overflow */
.nav-container {
gap: 0;
}
.hamburger {
display: flex;
margin-left: auto;
}

/* make sure the slide-down menu sits just below the shorter bar */
.nav-menu.active {
top: var(--header-h);
}

.nav-menu {
Expand Down
Loading