]> git.bochard.net Git - mysite.git/commitdiff
page indicator fix
authortenkyuu <hello@tenkyuu.dev>
Wed, 30 Oct 2024 01:49:44 +0000 (09:49 +0800)
committertenkyuu <hello@tenkyuu.dev>
Wed, 30 Oct 2024 01:49:44 +0000 (09:49 +0800)
js/script.js

index 49b783ce7f70ec7b9f0cf9873bcafdaeae08f07e..1ca93fc9c9eb87b2673158eedcc8ebf274c2376b 100644 (file)
@@ -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