From: tenkyuu Date: Wed, 30 Oct 2024 01:49:44 +0000 (+0800) Subject: page indicator fix X-Git-Url: https://git.bochard.net/?a=commitdiff_plain;h=67b8353080cd0aa21d494cc4dee71efcfc1ac93d;p=mysite.git page indicator fix --- 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