Files
hugo-coder-timeline/layouts/shortcodes/tab.html
Codruț Constantin Gușoi 5e4e500cdf HTML/CSS only tabs (#678)
* Fix pre tag margin top so it looks good inside containers

* Bind to 0.0.0.0 for docker container support

* Add HTML only tabs shortcode
2022-05-29 15:43:09 -03:00

18 lines
694 B
HTML

{{ $group := .Page.Scratch.Get "tabGroupIndex" | default 0 }}
{{ $index := .Page.Scratch.Get "tabElementIndex" | default 0 }}
{{ $name := .Get "name" | default "Name Me!" }}
<style>
.tabs input#tab-{{ $group }}-{{ $index }}:checked ~ .tab-content-{{ $group }}-{{ $index }} {
display: block;
}
</style>
<input type="radio" class="tab-input" name="tab-select-{{ $group }}" id="tab-{{ $group }}-{{ $index }}" {{ if eq $index 0 }}checked{{ end }}/>
<label for="tab-{{ $group }}-{{ $index }}" class="tab-label">{{ $name }}</label>
<div class="tab-content tab-content-{{ $group }}-{{ $index }}">
{{ .Inner | markdownify }}
</div>
{{ .Page.Scratch.Set "tabElementIndex" (add 1 $index) }}