Skip to content

Commit 1e46ae5

Browse files
committed
feat: add scroll effect to header and improve styling for better visibility
1 parent 5fdd015 commit 1e46ae5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/Navigation.astro

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const navItems = ['Home', 'Bio', 'Skills', 'Projects', 'Contact'];
33
---
44

5-
<header class="fixed top-0 left-0 right-0 z-20 bg-grayblue-800 bg-opacity-90">
5+
<header id="main-header" class="fixed top-0 left-0 right-0 z-20 bg-grayblue-800 backdrop-blur-md bg-opacity-90 transition-all duration-300 ease-in-out">
66
<nav class="container mx-auto px-6 py-4">
77
<!-- Mobile menu button -->
88
<div class="flex items-center justify-between md:hidden">
@@ -69,4 +69,16 @@ const navItems = ['Home', 'Bio', 'Skills', 'Projects', 'Contact'];
6969
});
7070
});
7171
}
72+
73+
// Header scroll effect
74+
const header = document.getElementById('main-header');
75+
if (header) {
76+
window.addEventListener('scroll', () => {
77+
if (window.scrollY > 50) { // Adjust 50 to your preferred scroll distance
78+
header.classList.add('bg-grayblue-800/60');
79+
} else {
80+
header.classList.remove('bg-grayblue-800/60');
81+
}
82+
});
83+
}
7284
</script>

0 commit comments

Comments
 (0)