mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-08 14:49:43 +00:00
Fix smooth scrolling for footnotes (#103)
Footnotes are using a fragment format with a colon inside ("#fn:1" for example). However, ":" is a special character for jQuery (http://api.jquery.com/category/selectors/), thus the target anchor is never found and the scrolling does not happen. This change selects the right target element using vanilla Javascript to bypass special characters that could be in the fragment part.
This commit is contained in:
parent
5afb81ca58
commit
826b4c2c9f
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||
$("a[href^=\"#\"]").click(function(e) {
|
||||
e.preventDefault();
|
||||
$("html, body").animate({
|
||||
scrollTop: $(this.hash).offset().top
|
||||
scrollTop: $(document.getElementById(this.hash.substr(1))).offset().top
|
||||
}, 500);
|
||||
$("#nav-menu").removeClass("is-active");
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue