Revert ToC style and script

This commit is contained in:
Helen Chong 2023-08-29 13:06:59 +08:00
parent b246e43483
commit 115f39a4ec
2 changed files with 3 additions and 16 deletions

View File

@ -40,10 +40,6 @@
} }
/* Sidebar Table of Contents */ /* Sidebar Table of Contents */
.left-sidebar {
display: none;
}
.sidebar__toc { .sidebar__toc {
position: sticky; position: sticky;
top: 5rem; top: 5rem;
@ -70,9 +66,3 @@
padding-left: 1.25rem; padding-left: 1.25rem;
list-style-type: disc; list-style-type: disc;
} }
@media only screen and (min-width: 43.75rem) {
.left-sidebar {
display: flex;
}
}

View File

@ -64,14 +64,11 @@ window.addEventListener('DOMContentLoaded', (event) => {
toc.setAttribute('open', true); toc.setAttribute('open', true);
} }
// Hide the left sidebar if the ToC is larger than screen height // Remove the stickiness of the sidebar ToC if it is larger than screen height
function preventSidebarOverflow() { function preventSidebarOverflow() {
if (document.documentElement.clientHeight < tocSidebar.offsetHeight + 50) { if (document.documentElement.clientHeight < tocSidebar.offsetHeight + 50) {
// tocSidebar.style.marginTop = "0"; tocSidebar.style.marginTop = "0";
// tocSidebar.style.position = "static"; tocSidebar.style.position = "static";
leftSidebar.style.display = "none";
} else {
leftSidebar.style.display = "flex";
} }
} }
preventSidebarOverflow(); preventSidebarOverflow();