help: Fix broken anchor link handling in documentation.

Fixes #10022.
This commit is contained in:
Cynthia Lin
2018-07-16 17:13:52 -07:00
committed by Tim Abbott
parent b49f34ae77
commit eaeec30590

View File

@@ -80,7 +80,7 @@ function scrollToHash(simplebar) {
var hash = window.location.hash;
var scrollbar = simplebar.getScrollElement();
if (hash !== '') {
var position = $(hash).position().top - $(simplebar.el).position().top;
var position = $(hash).position().top - $(scrollbar.firstChild).position().top;
scrollbar.scrollTop = position;
} else {
scrollbar.scrollTop = 0;
@@ -169,7 +169,8 @@ function scrollToHash(simplebar) {
// Scroll to anchor link when clicked
$(document).on('click', '.markdown .content h1, .markdown .content h2, .markdown .content h3', function () {
location.hash = $(this).attr("id");
window.location.hash = $(this).attr("id");
scrollToHash(markdownSB);
});
$(".hamburger").click(function () {