Navbar Scroll Fixed

This commit is contained in:
2025-08-15 09:07:34 +01:00
parent b3a76cc11f
commit b80e81ae9a
+14 -3
View File
@@ -47,7 +47,7 @@
<a
:href="item.href"
class="block text-white hover:text-primary ease-linear text-2xl md:text-lg"
@click2="scrollToSection(item.href)"
@click="scrollToSection(item.href)"
>
{{ item.name }}
</a>
@@ -58,7 +58,9 @@
</template>
<script setup>
import { ref } from "vue";
import { ref, watch } from "vue";
const isMenuOpen = ref(false);
const Menu = ref([
{ name: "Services", href: "#services" },
@@ -69,7 +71,16 @@ const Menu = ref([
{ name: "Contact", href: "#contact" },
]);
const isMenuOpen = ref(false);
watch(isMenuOpen, (open) => {
if (open) {
// Disable scrolling
document.body.style.overflow = "hidden";
} else {
// Re-enable scrolling
document.body.style.overflow = "";
}
});
const scrollToSection = (href) => {
isMenuOpen.value = false;
const section = document.querySelector(href);