mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-14 07:52:52 +08:00
Removed invalid comments, and formatted the code.
This commit is contained in:
@ -173,8 +173,6 @@ let setupPageShow = window.setupPageShow = function (pageId) {
|
|||||||
|
|
||||||
function addNavObserver(headings) {
|
function addNavObserver(headings) {
|
||||||
// Setup the intersection observer.
|
// Setup the intersection observer.
|
||||||
// margin top = -35px to trigger the threshold change before the heading
|
|
||||||
// has completely left the viewport on the top.
|
|
||||||
let intersectOpts = {
|
let intersectOpts = {
|
||||||
rootMargin: '0px 0px 0px 0px',
|
rootMargin: '0px 0px 0px 0px',
|
||||||
threshold: 1.0
|
threshold: 1.0
|
||||||
@ -192,7 +190,7 @@ let setupPageShow = window.setupPageShow = function (pageId) {
|
|||||||
for (let i = 0; i !== entries.length; ++i) {
|
for (let i = 0; i !== entries.length; ++i) {
|
||||||
let currentEntry = entries[i];
|
let currentEntry = entries[i];
|
||||||
let element = currentEntry.target;
|
let element = currentEntry.target;
|
||||||
// check if its currently visible and its distance from top of viewport is less than 100
|
// check if its currently visible
|
||||||
if (currentEntry.intersectionRatio === 1) {
|
if (currentEntry.intersectionRatio === 1) {
|
||||||
highlightElement(element.id);
|
highlightElement(element.id);
|
||||||
} else {
|
} else {
|
||||||
@ -202,7 +200,7 @@ let setupPageShow = window.setupPageShow = function (pageId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function highlightElement(elementId) {
|
function highlightElement(elementId) {
|
||||||
$pageNav.find('a[href="#' + elementId + '"]').addClass('current-heading');
|
$pageNav.find('a[href="#' + elementId + '"]').addClass('current-heading');
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeHighlight(elementId) {
|
function removeHighlight(elementId) {
|
||||||
|
Reference in New Issue
Block a user