From 67b8353080cd0aa21d494cc4dee71efcfc1ac93d Mon Sep 17 00:00:00 2001 From: tenkyuu Date: Wed, 30 Oct 2024 09:49:44 +0800 Subject: [PATCH] page indicator fix --- js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/script.js b/js/script.js index 49b783c..1ca93fc 100644 --- a/js/script.js +++ b/js/script.js @@ -17,11 +17,11 @@ function nullLink() { } // navigation - page indicator -const active_page = window.location.pathname; +const active_page = window.location.pathname === "/" ? "/index.html" : window.location.pathname; console.log(active_page); const nav_links = document.querySelectorAll(".nav-link").forEach(link => { - if(link.href.includes(`${active_page}`)) { + if(link.href.includes(active_page)) { link.classList.add("active-page"); } }) \ No newline at end of file -- 2.39.5