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
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/js/index.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index 3b1a6b3..5705bd2 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -21,8 +21,15 @@ document.addEventListener("DOMContentLoaded", function () {
// Bitty scrolling links script
$("a[href^=\"#\"]").click(function(e) {
e.preventDefault();
+ //BUG fix: https://github.com/victoriadrake/hugo-theme-introduction/issues/108
+ //
+ //let's get the right attribute `id` of the heading
+ v = e.target.href.replace(/http.*#/, '')
+ id = decodeURI(v)
+
$("html, body").animate({
- scrollTop: $(document.getElementById(this.hash.substr(1))).offset().top
+ //scrollTop: $(document.getElementById(this.hash.substr(1))).offset().top
+ scrollTop: $(document.getElementById(id)).offset().top
}, 500);
$("#nav-menu").removeClass("is-active");
return true;