mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-08 14:49:43 +00:00
fix: if heading contains non English characters, cannot scroll properly (#228)
This commit is contained in:
parent
e781be1620
commit
89b8d152a9
1 changed files with 8 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue