1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Updated design of page navigation box

This commit is contained in:
Dan Brown
2019-02-16 15:39:11 +00:00
parent b00b319e83
commit 352cbbd074
3 changed files with 39 additions and 19 deletions

View File

@ -208,8 +208,8 @@ class PageDisplay {
let pageNavObserver = new IntersectionObserver(headingVisibilityChange, intersectOpts);
// observe each heading
for (let i = 0; i !== headings.length; ++i) {
pageNavObserver.observe(headings[i]);
for (let heading of headings) {
pageNavObserver.observe(heading);
}
}
@ -221,14 +221,9 @@ class PageDisplay {
}
function toggleAnchorHighlighting(elementId, shouldHighlight) {
let anchorsToHighlight = pageNav.querySelectorAll('a[href="#' + elementId + '"]');
for (let i = 0; i < anchorsToHighlight.length; i++) {
// Change below to use classList.toggle when IE support is dropped.
if (shouldHighlight) {
anchorsToHighlight[i].classList.add('current-heading');
} else {
anchorsToHighlight[i].classList.remove('current-heading');
}
const anchorsToHighlight = pageNav.querySelectorAll('a[href="#' + elementId + '"]');
for (let anchor of anchorsToHighlight) {
anchor.closest('li').classList.toggle('current-heading', shouldHighlight);
}
}
}