mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 10:21:46 +01:00
feat: display header anchor on hover (#999)
This commit is contained in:
parent
ce798a32a9
commit
130e2f6607
2 changed files with 19 additions and 1 deletions
|
@ -222,6 +222,24 @@
|
||||||
margin-inline-start: calc((var(--card-padding)) * -1);
|
margin-inline-start: calc((var(--card-padding)) * -1);
|
||||||
padding-inline-start: calc(var(--card-padding) - var(--heading-border-size));
|
padding-inline-start: calc(var(--card-padding) - var(--heading-border-size));
|
||||||
border-inline-start: var(--heading-border-size) solid var(--accent-color);
|
border-inline-start: var(--heading-border-size) solid var(--accent-color);
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
a.header-anchor {
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
width: var(--card-padding);
|
||||||
|
text-align: center;
|
||||||
|
color: var(--accent-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus {
|
||||||
|
a.header-anchor {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<h{{ .Level }} id="{{ .Anchor }}">
|
<h{{ .Level }} id="{{ .Anchor }}">
|
||||||
<a href="#{{ .Anchor }}">#</a>
|
<a href="#{{ .Anchor }}" class="header-anchor">#</a>
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text | safeHTML }}
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
Loading…
Reference in a new issue