Skip to content

Commit 441e1ce

Browse files
committed
Content did not scroll when move between anchors
When GENERATE_TREEVIEW=YES, and using the browser's back/forward buttons between anchors on the same page, the content did not scroll.
1 parent e692012 commit 441e1ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

templates/html/navtree.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function createIndent(o,domNode,node) {
114114

115115
let animationInProgress = false;
116116

117-
function gotoAnchor(anchor,aname,updateLocation) {
117+
function gotoAnchor(anchor,aname) {
118118
let pos, docContent = $('#doc-content');
119119
let ancParent = $(anchor.parent());
120120
if (ancParent.hasClass('memItemLeft') ||
@@ -135,7 +135,7 @@ function gotoAnchor(anchor,aname,updateLocation) {
135135
docContent.animate({
136136
scrollTop: pos + docContent.scrollTop() - docContent.offset().top
137137
},Math.max(50,Math.min(500,dist)),function(){
138-
if (updateLocation) window.location.href=aname;
138+
window.location.href=aname;
139139
animationInProgress=false;
140140
});
141141
}
@@ -191,7 +191,7 @@ function newNode(o, po, text, link, childrenData, lastNode) {
191191
$(a).parent().parent().attr('id','selected');
192192
}
193193
const anchor = $(aname);
194-
gotoAnchor(anchor,aname,true);
194+
gotoAnchor(anchor,aname);
195195
};
196196
} else {
197197
a.href = url;
@@ -276,6 +276,7 @@ function highlightAnchor() {
276276
} else {
277277
glowEffect(anchor.next(),1000); // normal member
278278
}
279+
gotoAnchor(anchor,aname);
279280
}
280281

281282
function selectAndHighlight(hash,n) {
@@ -505,7 +506,7 @@ function initNavTree(toroot,relpath) {
505506
$("div.toc a[href]").click(function(e) {
506507
e.preventDefault();
507508
const aname = $(this).attr("href");
508-
gotoAnchor($(aname),aname,true);
509+
gotoAnchor($(aname),aname);
509510
})
510511
}
511512
/* @license-end */

0 commit comments

Comments
 (0)