From 230360552b44a8e45496da76ae539a63ad0a3f5a Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Sun, 24 Jul 2022 03:12:49 +0200 Subject: [PATCH] add toc side support --- assets/css/common/post-single.css | 16 +++++++++++----- layouts/partials/toc.html | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 186461e8..8c27764e 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -272,19 +272,25 @@ padding: 0.4em; } +@media screen and (min-width: 1400px) { + .toc.side { + position: fixed; + right: 30px; + top: 100px; + width: 300px; + font-size: .9em; + } +} + .dark .toc { background: var(--entry); } .toc details summary { - cursor: zoom-in; + cursor: pointer; margin-inline-start: 20px; } -.toc details[open] summary { - cursor: zoom-out; -} - .toc .details { display: inline; font-weight: 500; diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index d9b8b234..5965bf8b 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,7 +1,7 @@ {{- $headers := findRE "(.|\n])+?" .Content -}} {{- $has_headers := ge (len $headers) 1 -}} {{- if $has_headers -}} -
+
{{- i18n "toc" | default "Table of Contents" }}