mirror of
https://github.com/placeholder-soft/prodigyapi.git
synced 2026-04-24 03:55:10 +08:00
Fix bug with initial load of ToC always jumping to top
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user