Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Membrives <etienne@membrives.fr>2018-11-13 13:03:07 +0300
committerHanzei <16541325+hanzei@users.noreply.github.com>2018-11-13 13:03:07 +0300
commit826b4c2c9f2f8281310cd6a2f1f8011d316b544e (patch)
tree066dd19832459af7d8ab8dfcef4c42cda5cc648e
parent5afb81ca58cc8165f997fbc18543bee9a8049093 (diff)
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.
-rw-r--r--assets/js/index.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 68f26d3..3b1a6b3 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -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;