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
12 changes: 12 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ window.addEventListener('scroll', () => {
}
});

// Close menu when clicking outside
document.addEventListener('click', (e) => {
if (navMenu.classList.contains('active') &&
!navMenu.contains(e.target) &&
!hamburger.contains(e.target)) {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
hamburger.setAttribute('aria-expanded', 'false');
document.body.style.overflow = '';
}
});

// Active navigation highlighting
function updateActiveNav() {
const sections = document.querySelectorAll('section[id]');
Expand Down
68 changes: 24 additions & 44 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,41 @@ body {
}

.nav-menu {
position: fixed;
top: -100%;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.98);
backdrop-filter: blur(15px);
display: flex;
flex-direction: column;
list-style: none;
gap: 2.5rem;
gap: 1rem;
align-items: center;
padding: 2rem 0;
transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border-bottom: 1px solid #333;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
z-index: 999;
}

.nav-menu.active {
top: var(--header-h);
display: flex;
}

.nav-menu a {
color: #ffffff;
text-decoration: none;
font-weight: 500;
font-size: 0.95rem;
font-size: 1.1rem;
transition: all 0.3s ease;
padding: 0.5rem 1rem;
padding: 1rem 2rem;
border-radius: 6px;
position: relative;
display: block;
width: 200px;
text-align: center;
}

.nav-menu a:hover {
Expand Down Expand Up @@ -141,7 +161,7 @@ body {
}

.hamburger {
display: none;
display: flex;
flex-direction: column;
cursor: pointer;
gap: 4px;
Expand Down Expand Up @@ -860,46 +880,6 @@ body {
.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 {
position: fixed;
top: -100%;
left: 0;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.98);
backdrop-filter: blur(15px);
width: 100%;
text-align: center;
transition: 0.3s;
padding: 2rem 0;
gap: 1rem;
border-bottom: 1px solid #333;
z-index: 1001;
}

.nav-menu.active {
top: 70px;
}

.nav-menu a {
padding: 1rem 2rem;
margin: 0.5rem 1rem;
border-radius: 8px;
font-size: 1.1rem;
}

.nav-menu a::after {
display: none;
}

.hero-container {
grid-template-columns: 1fr;
Expand Down
Loading