summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/partials/footer.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 38f6d30..efab5bb 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -10,4 +10,13 @@
<script src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"></script>
<script>
hljs.initHighlightingOnLoad();
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener("click", function (e) {
+ e.preventDefault();
+
+ document.querySelector(this.getAttribute("href")).scrollIntoView({
+ behavior: "smooth"
+ });
+ });
+ });
</script> \ No newline at end of file