Skip to content

Commit

Permalink
Content did not scroll when move between anchors
Browse files Browse the repository at this point in the history
When GENERATE_TREEVIEW=YES, and using the browser's back/forward
buttons between anchors on the same page, the content did not scroll.
  • Loading branch information
doxygen committed Nov 3, 2023
1 parent e692012 commit 441e1ce
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions templates/html/navtree.js
Expand Up @@ -114,7 +114,7 @@ function createIndent(o,domNode,node) {

let animationInProgress = false;

function gotoAnchor(anchor,aname,updateLocation) {
function gotoAnchor(anchor,aname) {
let pos, docContent = $('#doc-content');
let ancParent = $(anchor.parent());
if (ancParent.hasClass('memItemLeft') ||
Expand All @@ -135,7 +135,7 @@ function gotoAnchor(anchor,aname,updateLocation) {
docContent.animate({
scrollTop: pos + docContent.scrollTop() - docContent.offset().top
},Math.max(50,Math.min(500,dist)),function(){
if (updateLocation) window.location.href=aname;
window.location.href=aname;
animationInProgress=false;
});
}
Expand Down Expand Up @@ -191,7 +191,7 @@ function newNode(o, po, text, link, childrenData, lastNode) {
$(a).parent().parent().attr('id','selected');
}
const anchor = $(aname);
gotoAnchor(anchor,aname,true);
gotoAnchor(anchor,aname);
};
} else {
a.href = url;
Expand Down Expand Up @@ -276,6 +276,7 @@ function highlightAnchor() {
} else {
glowEffect(anchor.next(),1000); // normal member
}
gotoAnchor(anchor,aname);
}

function selectAndHighlight(hash,n) {
Expand Down Expand Up @@ -505,7 +506,7 @@ function initNavTree(toroot,relpath) {
$("div.toc a[href]").click(function(e) {
e.preventDefault();
const aname = $(this).attr("href");
gotoAnchor($(aname),aname,true);
gotoAnchor($(aname),aname);
})
}
/* @license-end */

0 comments on commit 441e1ce

Please sign in to comment.