Fix scrollspy on link clicking, and # for top of page (#2023)
This commit is contained in:
parent
a974e45712
commit
1b7e8335fe
2 changed files with 6 additions and 3 deletions
|
@ -82,7 +82,7 @@ $(document).ready(function() {
|
|||
$(window).scroll(jQuery.throttle(250, function() {
|
||||
// Don't run while smooth scrolling (from clicking on a link).
|
||||
if (smoothScrolling) return;
|
||||
var scrollTop = $(window).scrollTop() + 20; // 20 = offset
|
||||
var scrollTop = $(window).scrollTop() + 20 + 1; // 20 = offset
|
||||
var links = [];
|
||||
$("nav.toc a").each(function() {
|
||||
var link = $(this);
|
||||
|
@ -106,9 +106,12 @@ $(document).ready(function() {
|
|||
if (links[i].href !== location.hash) {
|
||||
history.replaceState(null, null, links[i].href);
|
||||
}
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ('#' !== location.hash) {
|
||||
history.replaceState(null, null, '#');
|
||||
}
|
||||
}));
|
||||
|
||||
// add lightbox class to all image links
|
||||
|
|
2
assets/js/main.min.js
vendored
2
assets/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue