diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index ea5183f..dde1366 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -24,7 +24,7 @@
{{- end }}
{{- if (not site.Params.disableScrollToTop) }}
-
+
@@ -44,7 +44,7 @@
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function (e) {
- e.preventDefault();
+ //e.preventDefault();
var id = this.getAttribute("href").substr(1);
if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView({
@@ -54,6 +54,7 @@
document.querySelector(`[id='${decodeURIComponent(id)}']`).scrollIntoView();
}
if (id === "top") {
+ document.querySelector('a').focus();
history.replaceState(null, null, " ");
} else {
history.pushState(null, null, `#${id}`);
@@ -85,12 +86,18 @@
if (document.body.className.includes("dark")) {
document.body.classList.remove('dark');
localStorage.setItem("pref-theme", 'light');
+ document.getElementById("theme-toggle").title = '浅色模式';
} else {
document.body.classList.add('dark');
localStorage.setItem("pref-theme", 'dark');
+ document.getElementById("theme-toggle").title = '深色模式';
}
})
-
+if (document.body.classList.contains('dark')) {
+ document.getElementById("theme-toggle").title = '深色模式';
+} else {
+ document.getElementById("theme-toggle").title = '浅色模式';
+}
{{- end }}
@@ -142,4 +149,4 @@
}
});
-{{- end }}
+{{- end }}
\ No newline at end of file