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;