diff options
author | DSRKafuU | 2020-04-24 14:35:40 +0800 |
---|---|---|
committer | GitHub | 2020-04-24 14:35:40 +0800 |
commit | 60262f7365898d0d54550da8e679064350814d1b (patch) | |
tree | 0b5d4878444e7633cd0b4af893d7fe69538e0fbd | |
parent | 50900be20164758f1ae3ef1fb18d65424bc98743 (diff) | |
parent | 545b156568672aa6b28713ca4ee6d153ade2281a (diff) | |
download | hugo-theme-fuji-60262f7365898d0d54550da8e679064350814d1b.tar.gz hugo-theme-fuji-60262f7365898d0d54550da8e679064350814d1b.tar.bz2 hugo-theme-fuji-60262f7365898d0d54550da8e679064350814d1b.zip |
Merge pull request #7 from amzrk2/patch-toc
Smooth toc html anchor scrolling
Also cover smoothscroll.js's click event listener which causes #6
-rw-r--r-- | layouts/partials/scripts.html | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index 2f83c91..fd5aa3b 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -60,6 +60,17 @@ }); </script> {{ end }} +{{ if in .Site.Params.mainSections .Type }} +<!-- toc smooth scroll & aplayer cjk html anchor fix --> +<script> + $("#widget-toc a").click(function () { + $("html, body").animate({ + scrollTop: $($(this).attr("href")).offset().top + }); + return false; + }); +</script> +{{ end }} {{ if .Site.Params.scrollTop }} <!-- scroll to top button --> <script> |