From c59cb293bf3f3b4415b31ca9420c1d449cf2fad4 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Mon, 5 May 2025 08:30:34 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Feat:=20Prevent=20ToC=20flicker=20o?= =?UTF-8?q?n=20initial=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use CSS to control ToC height instead of JavaScript to prevent flickering. --- assets/css/compiled/main.css | 9 +++++++-- assets/css/main.css | 6 ++++++ layouts/partials/toc.html | 31 ++----------------------------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 4260f50f..e27a715c 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1507,8 +1507,8 @@ body.zen-mode-enable { .overflow-visible { overflow: visible; } - .overflow-y-scroll { - overflow-y: scroll; + .overflow-y-auto { + overflow-y: auto; } .overscroll-contain { overscroll-behavior: contain; @@ -3537,6 +3537,11 @@ body a, body button { #TableOfContents { max-width: 25vw; } +#TOCView { + max-height: calc(100vh - 150px); + min-height: 0; + overflow-x: hidden; +} .toc ul, .toc li { list-style-type: none; padding-inline: calc(var(--spacing) * 0); diff --git a/assets/css/main.css b/assets/css/main.css index b2e71447..6b67490a 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -63,6 +63,12 @@ body button { max-width: 25vw; } +#TOCView { + max-height: calc(100vh - 150px); + min-height: 0; + overflow-x: hidden; +} + .toc ul, .toc li { @apply px-0 leading-snug list-none; diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 5f3ffa1f..f7d0acf7 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,5 +1,4 @@ -