mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-21 18:11:37 +01:00
add toc side support
This commit is contained in:
parent
09c9be232f
commit
230360552b
@ -272,19 +272,25 @@
|
|||||||
padding: 0.4em;
|
padding: 0.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1400px) {
|
||||||
|
.toc.side {
|
||||||
|
position: fixed;
|
||||||
|
right: 30px;
|
||||||
|
top: 100px;
|
||||||
|
width: 300px;
|
||||||
|
font-size: .9em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.dark .toc {
|
.dark .toc {
|
||||||
background: var(--entry);
|
background: var(--entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toc details summary {
|
.toc details summary {
|
||||||
cursor: zoom-in;
|
cursor: pointer;
|
||||||
margin-inline-start: 20px;
|
margin-inline-start: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toc details[open] summary {
|
|
||||||
cursor: zoom-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toc .details {
|
.toc .details {
|
||||||
display: inline;
|
display: inline;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}}
|
{{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}}
|
||||||
{{- $has_headers := ge (len $headers) 1 -}}
|
{{- $has_headers := ge (len $headers) 1 -}}
|
||||||
{{- if $has_headers -}}
|
{{- if $has_headers -}}
|
||||||
<div class="toc">
|
<div class="toc side">
|
||||||
<details {{if (.Param "TocOpen") }} open{{ end }}>
|
<details {{if (.Param "TocOpen") }} open{{ end }}>
|
||||||
<summary accesskey="c" title="(Alt + C)">
|
<summary accesskey="c" title="(Alt + C)">
|
||||||
<span class="details">{{- i18n "toc" | default "Table of Contents" }}</span>
|
<span class="details">{{- i18n "toc" | default "Table of Contents" }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user