From 4149899000c416b56470bbd2900160f32e2a6f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sat, 17 Aug 2024 20:01:53 +0800 Subject: [PATCH] =?UTF-8?q?navbar=20=E9=9A=8F=E7=82=B9=E5=87=BB=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.js b/main.js index 17a200e..99c121d 100644 --- a/main.js +++ b/main.js @@ -15,6 +15,12 @@ document.body.appendChild(header.flex({ justifyContent: 'space-between', alignIt link.style.padding = '.5rem' link.style.borderRadius = '.25rem' link.style.color = (item.path === window.location.pathname) ? '#00C16A' : '#333' + link.onclick = (event) => { + event.preventDefault() + window.history.pushState({}, '', event.target.href) + Array.from(event.target.parentElement.children).forEach(x => x.style.color = '#333') + event.target.style.color = '#00C16A' + } return link })), div.text('sign'),