diff --git a/_assets/js/api-toc.js b/_assets/js/api-toc.js index 79adcc5..b74a352 100644 --- a/_assets/js/api-toc.js +++ b/_assets/js/api-toc.js @@ -7,7 +7,15 @@ $(function () { e.preventDefault(); animateScrolling(this.hash); }; - + + // Detect hash on page load and readjust scroll offset + var initialHash = window.location.hash; + if (!!initialHash) { + setTimeout(function(){ + animateScrolling(initialHash); + }, 100); + } + $("#markdown-toc") .on("click", "a", function () { $(".section > ul").hide(); diff --git a/_assets/js/toc.js b/_assets/js/toc.js index 987ff84..64deed7 100644 --- a/_assets/js/toc.js +++ b/_assets/js/toc.js @@ -52,7 +52,15 @@ $(function() { e.preventDefault(); animateScrolling(this.hash); }; - + + // Detect hash on page load and readjust scroll offset + var initialHash = window.location.hash; + if (!!initialHash) { + setTimeout(function(){ + animateScrolling(initialHash); + }, 100); + } + // animated scroll // Exclude the app inside the div.theme-preview since it's not in an