Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
atteggiani committed Jul 7, 2023
1 parent 5efaa71 commit 876722d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/js/miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function sortTables() {
tables.forEach(table => new Tablesort(table));
}


// Remove 'Made with Material for MkDocs' from copyright
function removeMkDocs() {
let copyright = document.querySelector(".md-copyright");
Expand All @@ -16,6 +17,7 @@ function removeMkDocs() {
}
}


/*
Adjust the scrolling so that the paragraph's titles is not
partially covered by the sticky banner when clicking on a toc link
Expand All @@ -27,10 +29,8 @@ function adjustScrollingToId() {
function adjustClick() {
links.forEach(link => link.addEventListener('click', e => {
e.preventDefault();
if (location.pathname.replace(/^\//,'') == link.pathname.replace(/^\//,'') && location.hostname == link.hostname) {
let offset = header.offsetHeight
window.scrollTo(0, document.querySelector(link.hash).offsetTop - offset);
}
let offset = header.offsetHeight
window.scrollTo(0, document.querySelector(link.hash).offsetTop - offset);
}))
}

Expand All @@ -40,10 +40,12 @@ function adjustScrollingToId() {
observer.observe(header);
}

// Join all functions
function main() {
sortTables();
removeMkDocs();
adjustScrollingToId();
}

// Run all functions
window.onload = () => document$.subscribe(() => main());

0 comments on commit 876722d

Please sign in to comment.