From e0950fc973d029dc65d0bc1bd68f3d11242527c8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 29 Apr 2024 03:36:16 +0800 Subject: [PATCH] fix: make TOC title and entries visible at the same time (#1711) When internet connection speeds are poor, there is a chance that the title of the TOC will appear earlier than its entries, causing a visual cutoff. --- _includes/toc.html | 4 ++-- _javascript/modules/components/toc.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/_includes/toc.html b/_includes/toc.html index 604d2c1658e..15eb93455e5 100644 --- a/_includes/toc.html +++ b/_includes/toc.html @@ -6,8 +6,8 @@ {% endif %} {% if enable_toc %} -
-

{{- site.data.locales[include.lang].panel.toc -}}

+
+

{{- site.data.locales[include.lang].panel.toc -}}

{% endif %} diff --git a/_javascript/modules/components/toc.js b/_javascript/modules/components/toc.js index b397813c01f..56ce26fac50 100644 --- a/_javascript/modules/components/toc.js +++ b/_javascript/modules/components/toc.js @@ -9,5 +9,7 @@ export function toc() { orderedList: false, scrollSmooth: false }); + + document.getElementById('toc-wrapper').classList.remove('d-none'); } }