mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-22 10:31:39 +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 src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}"></script>
|
||||||
<script>
|
<script>
|
||||||
hljs.initHighlightingOnLoad();
|
hljs.initHighlightingOnLoad();
|
||||||
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||||
|
anchor.addEventListener("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
document.querySelector(this.getAttribute("href")).scrollIntoView({
|
||||||
|
behavior: "smooth"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue
Block a user