From 115f39a4ecf9d9c07b09a643bf169ab92617391b Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:06:59 +0800 Subject: [PATCH] Revert ToC style and script --- css/style-toc.css | 10 ---------- js/toc.js | 9 +++------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/css/style-toc.css b/css/style-toc.css index df889dad..d8c27d66 100644 --- a/css/style-toc.css +++ b/css/style-toc.css @@ -40,10 +40,6 @@ } /* Sidebar Table of Contents */ -.left-sidebar { - display: none; -} - .sidebar__toc { position: sticky; top: 5rem; @@ -69,10 +65,4 @@ padding-top: 0.5em; padding-left: 1.25rem; list-style-type: disc; -} - -@media only screen and (min-width: 43.75rem) { - .left-sidebar { - display: flex; - } } \ No newline at end of file diff --git a/js/toc.js b/js/toc.js index eb7dada7..e8013018 100644 --- a/js/toc.js +++ b/js/toc.js @@ -64,14 +64,11 @@ window.addEventListener('DOMContentLoaded', (event) => { 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() { if (document.documentElement.clientHeight < tocSidebar.offsetHeight + 50) { - // tocSidebar.style.marginTop = "0"; - // tocSidebar.style.position = "static"; - leftSidebar.style.display = "none"; - } else { - leftSidebar.style.display = "flex"; + tocSidebar.style.marginTop = "0"; + tocSidebar.style.position = "static"; } } preventSidebarOverflow();