From 228edcf860a64cbe4265dd8f4b941e622de29809 Mon Sep 17 00:00:00 2001 From: Rakesh Roshan Date: Mon, 16 Dec 2024 13:52:36 +0530 Subject: [PATCH] Added changes --- .vscode/settings.json | 3 --- assets/commonscript.js | 18 +++++++++++++----- index.html | 4 ---- script.js | 39 --------------------------------------- style.css | 9 ++------- 5 files changed, 15 insertions(+), 58 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f673a71b7..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "liveServer.settings.port": 5502 -} \ No newline at end of file diff --git a/assets/commonscript.js b/assets/commonscript.js index 9ea5cf9b3..fbaabd8c0 100644 --- a/assets/commonscript.js +++ b/assets/commonscript.js @@ -10,8 +10,8 @@ const updateProgress = () => { document.addEventListener('scroll', updateProgress); // Toggle mobile menu visibility -const hamBurger = document.querySelector(".hamburger"); -const nMenu = document.querySelector(".nav-menu"); +const hamburger = document.querySelector(".hamburger"); +const navMenu = document.querySelector(".nav-menu"); document.addEventListener("DOMContentLoaded", function () { setTimeout(function () { @@ -20,11 +20,19 @@ document.addEventListener("DOMContentLoaded", function () { }); // Hamburger menu -hamBurger.addEventListener("click", mobileMenu); +hamburger.addEventListener("click", mobileMenu); function mobileMenu() { - hamBurger.classList.toggle("active"); - nMenu.classList.toggle("active"); + hamburger.classList.toggle("active"); + navMenu.classList.toggle("active"); +} + +const navLink = document.querySelectorAll(".nav-link"); +navLink.forEach(n => n.addEventListener("click", closeMenu)); + +function closeMenu() { + hamburger.classList.remove("active"); + navMenu.classList.remove("active"); } // Hide or show scroll progress indicator diff --git a/index.html b/index.html index 3a974d86e..7386ead22 100644 --- a/index.html +++ b/index.html @@ -94,10 +94,6 @@ - - diff --git a/script.js b/script.js index d4ae58060..0fb8696b2 100644 --- a/script.js +++ b/script.js @@ -19,45 +19,6 @@ window.addEventListener('scroll', () => { }); }); -// Toggle mobile menu visibility -const hamburger = document.querySelector(".hamburger"); -const navMenu = document.querySelector(".nav-menu"); - -document.addEventListener("DOMContentLoaded", function () { - setTimeout(function () { - document.querySelector("body").classList.add("loaded"); - }, 500); -}); - -document.addEventListener("DOMContentLoaded", () => { - const hamburger = document.querySelector(".hamburger"); - const navMenu = document.querySelector(".nav-menu"); - - // Verify the elements exist - if (!hamburger || !navMenu) { - console.error("Hamburger or nav-menu element not found."); - return; - } - - // Attach click event to toggle menu visibility - hamburger.addEventListener("click", () => { - console.log("Hamburger clicked."); - hamburger.classList.toggle("active"); - navMenu.classList.toggle("show"); - }); - - // Close menu when a link is clicked - const navLinks = document.querySelectorAll(".nav-link"); - navLinks.forEach(link => { - link.addEventListener("click", () => { - console.log("Nav link clicked."); - hamburger.classList.remove("active"); - navMenu.classList.remove("show"); - }); - }); -}); - - // Google Translate function googleTranslateElementInit() { new google.translate.TranslateElement({ diff --git a/style.css b/style.css index 1b88b1e08..9e8dd51c0 100644 --- a/style.css +++ b/style.css @@ -2174,15 +2174,10 @@ footer { backdrop-filter: blur(7px); transition: 0.5s ease-in-out; } - .nav-menu.show { - display: flex; /* Or block, depending on your design */ - } - .nav-item { - margin: 10px ; - font-size: 30px; - + margin: 1.8rem 0; + font-size: 25px; } nav li:hover {