mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-12-23 01:21:04 +01:00
Add Smooth Scrolling
Thanks to Joseph Silber https://stackoverflow.com/a/7717572
This commit is contained in:
parent
16b98dc8f9
commit
163fa2d3f1
@ -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>
|
Loading…
Reference in New Issue
Block a user