summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-04-09 23:59:22 +0800
committerReorx <novoreorx@gmail.com>2022-04-09 23:59:22 +0800
commit60f139d529a00c90a75151912f3639060435a1d9 (patch)
treedd9dc54fc74403f0dfa3dd3bd82bf87c6b64be3f
parent8c5d10925e591c909e98c9a413e10b2e47c15b6d (diff)
add side class for toc if TocSide is true
-rw-r--r--assets/css/common/post-single.css15
-rw-r--r--layouts/partials/toc.html2
2 files changed, 11 insertions, 6 deletions
diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css
index b9b9709..07be079 100644
--- a/assets/css/common/post-single.css
+++ b/assets/css/common/post-single.css
@@ -263,20 +263,25 @@
border-radius: var(--radius);
padding: 0.4em;
}
+@media screen and (min-width: 1000px) {
+ .toc.side {
+ position: fixed;
+ right: 50px;
+ 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 d9b8b23..02a61e9 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,7 +1,7 @@
{{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}}
{{- $has_headers := ge (len $headers) 1 -}}
{{- if $has_headers -}}
-<div class="toc">
+<div class="toc{{- if (.Param "TocSide") -}}{{- print " side" -}}{{- end -}}">
<details {{if (.Param "TocOpen") }} open{{ end }}>
<summary accesskey="c" title="(Alt + C)">
<span class="details">{{- i18n "toc" | default "Table of Contents" }}</span>