From 51f242a7fda564034c803aa12dac8b73406459b9 Mon Sep 17 00:00:00 2001 From: akshaythakur8764 Date: Mon, 18 Nov 2024 13:37:18 +0530 Subject: [PATCH 1/3] active link --- src/components/layout/Nav.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/layout/Nav.astro b/src/components/layout/Nav.astro index f66ae42..d089669 100644 --- a/src/components/layout/Nav.astro +++ b/src/components/layout/Nav.astro @@ -15,7 +15,7 @@ document.addEventListener('DOMContentLoaded', () => { function addActiveClass() { if(window.location.hash){ - var currentUrl = window.location.pathname + window.location.hash; + var currentUrl = window.location.pathname + window.location.hash.replace(/\/+$/, ''); console.log(currentUrl); } else{ @@ -25,7 +25,7 @@ function addActiveClass() { menuItems.forEach(item => { var menuItemUrl = item.getAttribute('href'); - // console.log(menuItemUrl); + console.log(menuItemUrl); if (currentUrl === menuItemUrl || window.location.hash === menuItemUrl) { From 406bd874a17d016cafe32a07951468d9474dcf36 Mon Sep 17 00:00:00 2001 From: akshaythakur8764 Date: Mon, 18 Nov 2024 13:40:07 +0530 Subject: [PATCH 2/3] slash added --- src/components/layout/nav-links.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/layout/nav-links.json b/src/components/layout/nav-links.json index f3914d7..3a5fdbe 100644 --- a/src/components/layout/nav-links.json +++ b/src/components/layout/nav-links.json @@ -2,7 +2,7 @@ { "label": "About", "href": "/#about" }, {"label": "Problem-Statement", "href": "/problem-statement"}, - {"label": "Submission Guidelines", "href": "/problem-statement#submission-guidelines"}, + {"label": "Submission Guidelines", "href": "/problem-statement/#submission-guidelines"}, {"label": "Register", "href": "/#register"}, {"label": "FAQs", "href": "/faq"}, From 90dc97261720cd69f0ac154c397fd562e7e78dbe Mon Sep 17 00:00:00 2001 From: akshaythakur8764 Date: Mon, 18 Nov 2024 13:41:33 +0530 Subject: [PATCH 3/3] js change --- src/components/layout/Nav.astro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/layout/Nav.astro b/src/components/layout/Nav.astro index d089669..fe542c0 100644 --- a/src/components/layout/Nav.astro +++ b/src/components/layout/Nav.astro @@ -16,7 +16,7 @@ document.addEventListener('DOMContentLoaded', () => { function addActiveClass() { if(window.location.hash){ var currentUrl = window.location.pathname + window.location.hash.replace(/\/+$/, ''); - console.log(currentUrl); + // console.log(currentUrl); } else{ var currentUrl = window.location.pathname.replace(/\/+$/, '') + window.location.hash; @@ -25,7 +25,7 @@ function addActiveClass() { menuItems.forEach(item => { var menuItemUrl = item.getAttribute('href'); - console.log(menuItemUrl); + // console.log(menuItemUrl); if (currentUrl === menuItemUrl || window.location.hash === menuItemUrl) {