Spaces:
Running
Running
the mobile version has overlap
Browse files- components/navbar.js +30 -3
- script.js +13 -4
- style.css +7 -0
components/navbar.js
CHANGED
|
@@ -5,9 +5,9 @@ class CustomNavbar extends HTMLElement {
|
|
| 5 |
<style>
|
| 6 |
nav {
|
| 7 |
transition: background-color 0.3s ease;
|
|
|
|
| 8 |
}
|
| 9 |
.scrolled {
|
| 10 |
-
background-color: rgba(15, 23, 42, 0.95);
|
| 11 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 12 |
}
|
| 13 |
a {
|
|
@@ -26,6 +26,27 @@ class CustomNavbar extends HTMLElement {
|
|
| 26 |
a:hover::after {
|
| 27 |
width: 100%;
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</style>
|
| 30 |
<nav class="fixed w-full z-50 py-4 px-6 md:px-12 flex justify-between items-center">
|
| 31 |
<a href="/" class="text-2xl font-bold text-white">QUEST</a>
|
|
@@ -35,11 +56,17 @@ class CustomNavbar extends HTMLElement {
|
|
| 35 |
<a href="#invest" class="text-white">Invest</a>
|
| 36 |
<a href="#contact" class="text-white">Contact</a>
|
| 37 |
</div>
|
| 38 |
-
<button class="md:hidden text-white" aria-label="mobile menu">
|
| 39 |
<i data-feather="menu"></i>
|
| 40 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</nav>
|
| 42 |
-
|
| 43 |
}
|
| 44 |
}
|
| 45 |
|
|
|
|
| 5 |
<style>
|
| 6 |
nav {
|
| 7 |
transition: background-color 0.3s ease;
|
| 8 |
+
background-color: rgba(15, 23, 42, 0.95);
|
| 9 |
}
|
| 10 |
.scrolled {
|
|
|
|
| 11 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 12 |
}
|
| 13 |
a {
|
|
|
|
| 26 |
a:hover::after {
|
| 27 |
width: 100%;
|
| 28 |
}
|
| 29 |
+
.mobile-menu {
|
| 30 |
+
display: none;
|
| 31 |
+
position: absolute;
|
| 32 |
+
top: 100%;
|
| 33 |
+
left: 0;
|
| 34 |
+
right: 0;
|
| 35 |
+
background-color: rgba(15, 23, 42, 0.95);
|
| 36 |
+
padding: 1rem;
|
| 37 |
+
z-index: 50;
|
| 38 |
+
}
|
| 39 |
+
.mobile-menu.active {
|
| 40 |
+
display: block;
|
| 41 |
+
}
|
| 42 |
+
.mobile-menu a {
|
| 43 |
+
display: block;
|
| 44 |
+
padding: 0.75rem 0;
|
| 45 |
+
border-bottom: 1px solid rgba(255,255,255,0.1);
|
| 46 |
+
}
|
| 47 |
+
.mobile-menu a:last-child {
|
| 48 |
+
border-bottom: none;
|
| 49 |
+
}
|
| 50 |
</style>
|
| 51 |
<nav class="fixed w-full z-50 py-4 px-6 md:px-12 flex justify-between items-center">
|
| 52 |
<a href="/" class="text-2xl font-bold text-white">QUEST</a>
|
|
|
|
| 56 |
<a href="#invest" class="text-white">Invest</a>
|
| 57 |
<a href="#contact" class="text-white">Contact</a>
|
| 58 |
</div>
|
| 59 |
+
<button class="md:hidden text-white" aria-label="mobile menu" id="mobile-menu-button">
|
| 60 |
<i data-feather="menu"></i>
|
| 61 |
</button>
|
| 62 |
+
<div class="mobile-menu" id="mobile-menu">
|
| 63 |
+
<a href="#about" class="text-white">About</a>
|
| 64 |
+
<a href="#projects" class="text-white">Projects</a>
|
| 65 |
+
<a href="#invest" class="text-white">Invest</a>
|
| 66 |
+
<a href="#contact" class="text-white">Contact</a>
|
| 67 |
+
</div>
|
| 68 |
</nav>
|
| 69 |
+
`;
|
| 70 |
}
|
| 71 |
}
|
| 72 |
|
script.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
|
|
| 1 |
// Mobile menu toggle functionality
|
| 2 |
document.addEventListener('DOMContentLoaded', function() {
|
| 3 |
-
const mobileMenuButton = document.querySelector('
|
| 4 |
const mobileMenu = document.querySelector('#mobile-menu');
|
| 5 |
|
| 6 |
if (mobileMenuButton) {
|
| 7 |
mobileMenuButton.addEventListener('click', function() {
|
| 8 |
-
mobileMenu.classList.toggle('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
});
|
| 10 |
}
|
| 11 |
-
|
| 12 |
-
// Smooth scrolling for anchor links
|
| 13 |
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 14 |
anchor.addEventListener('click', function(e) {
|
| 15 |
e.preventDefault();
|
|
|
|
| 1 |
+
|
| 2 |
// Mobile menu toggle functionality
|
| 3 |
document.addEventListener('DOMContentLoaded', function() {
|
| 4 |
+
const mobileMenuButton = document.querySelector('#mobile-menu-button');
|
| 5 |
const mobileMenu = document.querySelector('#mobile-menu');
|
| 6 |
|
| 7 |
if (mobileMenuButton) {
|
| 8 |
mobileMenuButton.addEventListener('click', function() {
|
| 9 |
+
mobileMenu.classList.toggle('active');
|
| 10 |
+
const icon = this.querySelector('i');
|
| 11 |
+
if (mobileMenu.classList.contains('active')) {
|
| 12 |
+
feather.replace();
|
| 13 |
+
icon.setAttribute('data-feather', 'x');
|
| 14 |
+
} else {
|
| 15 |
+
feather.replace();
|
| 16 |
+
icon.setAttribute('data-feather', 'menu');
|
| 17 |
+
}
|
| 18 |
+
feather.replace();
|
| 19 |
});
|
| 20 |
}
|
| 21 |
+
// Smooth scrolling for anchor links
|
|
|
|
| 22 |
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 23 |
anchor.addEventListener('click', function(e) {
|
| 24 |
e.preventDefault();
|
style.css
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
|
|
| 1 |
/* Custom styles */
|
| 2 |
body {
|
| 3 |
overflow-x: hidden;
|
|
|
|
| 4 |
}
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
/* Smooth scrolling */
|
| 7 |
html {
|
| 8 |
scroll-behavior: smooth;
|
|
|
|
| 1 |
+
|
| 2 |
/* Custom styles */
|
| 3 |
body {
|
| 4 |
overflow-x: hidden;
|
| 5 |
+
padding-top: 80px; /* Add padding to account for fixed navbar */
|
| 6 |
}
|
| 7 |
|
| 8 |
+
@media (min-width: 768px) {
|
| 9 |
+
body {
|
| 10 |
+
padding-top: 0;
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
/* Smooth scrolling */
|
| 14 |
html {
|
| 15 |
scroll-behavior: smooth;
|