mirror of
https://github.com/danbulant/api_docs
synced 2026-05-20 12:48:39 +00:00
Fix bug with initial load of ToC always jumping to top
This commit is contained in:
parent
4d3787afd7
commit
5663fb8b4f
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue