Spaces:
Running
Running
make the three lines spin when i click on it
Browse files- index.html +23 -6
index.html
CHANGED
|
@@ -56,9 +56,11 @@
|
|
| 56 |
<a href="#about" class="hover:text-accent transition">About</a>
|
| 57 |
<a href="#contact" class="hover:text-accent transition">Contact</a>
|
| 58 |
</div>
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
</
|
|
|
|
|
|
|
| 62 |
</div>
|
| 63 |
</nav>
|
| 64 |
|
|
@@ -391,17 +393,32 @@
|
|
| 391 |
<a href="#" class="block text-xl text-white hover:text-accent transition py-2" onclick="hideMobileMenu()">Home</a>
|
| 392 |
</div>
|
| 393 |
</div>
|
| 394 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
feather.replace();
|
| 396 |
|
| 397 |
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
| 398 |
const mobileMenu = document.getElementById('mobile-menu');
|
|
|
|
| 399 |
function toggleMobileMenu() {
|
| 400 |
mobileMenu.classList.toggle('hidden');
|
|
|
|
| 401 |
document.body.style.overflow = mobileMenu.classList.contains('hidden') ? 'auto' : 'hidden';
|
| 402 |
}
|
| 403 |
-
|
| 404 |
-
function hideMobileMenu() {
|
| 405 |
mobileMenu.classList.add('hidden');
|
| 406 |
document.body.style.overflow = 'auto';
|
| 407 |
}
|
|
|
|
| 56 |
<a href="#about" class="hover:text-accent transition">About</a>
|
| 57 |
<a href="#contact" class="hover:text-accent transition">Contact</a>
|
| 58 |
</div>
|
| 59 |
+
<button class="md:hidden hamburger" id="mobile-menu-button">
|
| 60 |
+
<div class="hamburger-line w-6 h-0.5 bg-white mb-1.5"></div>
|
| 61 |
+
<div class="hamburger-line w-6 h-0.5 bg-white mb-1.5"></div>
|
| 62 |
+
<div class="hamburger-line w-6 h-0.5 bg-white"></div>
|
| 63 |
+
</button>
|
| 64 |
</div>
|
| 65 |
</nav>
|
| 66 |
|
|
|
|
| 393 |
<a href="#" class="block text-xl text-white hover:text-accent transition py-2" onclick="hideMobileMenu()">Home</a>
|
| 394 |
</div>
|
| 395 |
</div>
|
| 396 |
+
<style>
|
| 397 |
+
.hamburger-line {
|
| 398 |
+
transition: transform 0.3s ease;
|
| 399 |
+
}
|
| 400 |
+
.hamburger.active .hamburger-line:nth-child(1) {
|
| 401 |
+
transform: translateY(8px) rotate(45deg);
|
| 402 |
+
}
|
| 403 |
+
.hamburger.active .hamburger-line:nth-child(2) {
|
| 404 |
+
opacity: 0;
|
| 405 |
+
}
|
| 406 |
+
.hamburger.active .hamburger-line:nth-child(3) {
|
| 407 |
+
transform: translateY(-8px) rotate(-45deg);
|
| 408 |
+
}
|
| 409 |
+
</style>
|
| 410 |
+
<script>
|
| 411 |
feather.replace();
|
| 412 |
|
| 413 |
const mobileMenuButton = document.getElementById('mobile-menu-button');
|
| 414 |
const mobileMenu = document.getElementById('mobile-menu');
|
| 415 |
+
const hamburger = document.querySelector('.hamburger');
|
| 416 |
function toggleMobileMenu() {
|
| 417 |
mobileMenu.classList.toggle('hidden');
|
| 418 |
+
hamburger.classList.toggle('active');
|
| 419 |
document.body.style.overflow = mobileMenu.classList.contains('hidden') ? 'auto' : 'hidden';
|
| 420 |
}
|
| 421 |
+
function hideMobileMenu() {
|
|
|
|
| 422 |
mobileMenu.classList.add('hidden');
|
| 423 |
document.body.style.overflow = 'auto';
|
| 424 |
}
|