diff --git a/src/layout/Navbar.svelte b/src/layout/Navbar.svelte
index 62b354e..4cd8c13 100644
--- a/src/layout/Navbar.svelte
+++ b/src/layout/Navbar.svelte
@@ -2,7 +2,6 @@
import {
Button,
Dropdown,
- Grid,
Section,
} from "$components";
import { navigate, getPath, currentLang, text, switchLang } from "$lib";
@@ -21,18 +20,15 @@
import X from "lucide-svelte/icons/x";
let mobileMenuOpen = false;
+ let isClosing = false;
// Reactively control body scroll
$: if (typeof document !== 'undefined') {
if (mobileMenuOpen) {
document.body.style.overflow = 'hidden';
- document.body.style.position = 'fixed';
- document.body.style.width = '100%';
document.documentElement.style.overflow = 'hidden';
} else {
document.body.style.overflow = '';
- document.body.style.position = '';
- document.body.style.width = '';
document.documentElement.style.overflow = '';
}
}
@@ -41,18 +37,21 @@
onDestroy(() => {
if (typeof document !== 'undefined') {
document.body.style.overflow = '';
- document.body.style.position = '';
- document.body.style.width = '';
document.documentElement.style.overflow = '';
}
});
function toggleMobileMenu() {
mobileMenuOpen = !mobileMenuOpen;
+ isClosing = false;
}
function closeMobileMenu() {
- mobileMenuOpen = false;
+ isClosing = true;
+ setTimeout(() => {
+ mobileMenuOpen = false;
+ isClosing = false;
+ }, 300); // Match animation duration
}
function handleNavigation(path, options = {}) {
@@ -61,8 +60,36 @@
}
+
+