Fix bug with initial load of ToC always jumping to top

This commit is contained in:
Robert Lord
2017-07-06 23:32:22 -07:00
parent 4d3787afd7
commit 5663fb8b4f

View File

@@ -3,6 +3,8 @@
;(function () {
'use strict';
var loaded = false;
var debounce = function(func, waitTime) {
var timeout = false;
return function() {
@@ -57,6 +59,12 @@
}
}
// Catch the initial load case
if (currentTop == scrollOffset && !loaded) {
best = window.location.hash;
loaded = true;
}
var $best = $toc.find("[href='" + best + "']").first();
if (!$best.hasClass("active")) {
// .active is applied to the ToC link we're currently on, and its parent <ul>s selected by tocListSelector