From 826b4c2c9f2f8281310cd6a2f1f8011d316b544e Mon Sep 17 00:00:00 2001 From: Etienne Membrives Date: Tue, 13 Nov 2018 11:03:07 +0100 Subject: 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. --- assets/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'assets') 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; -- cgit v1.2.3