hugo-theme-relearn/layouts/partials/shortcodes/expand.html

26 lines
1.2 KiB
HTML
Raw Normal View History

{{- $context := .context }}
{{- $content := .content }}
{{- $title := .title | default (T "Expand-title") }}
{{- $expanded := .open | default false }}
{{- if eq (printf "%T" $expanded) "string" }}
{{- $expanded = (eq $expanded "true") }}
{{- end }}
2022-11-01 01:00:50 +00:00
{{- $direction := T "Reading-direction" | default "ltr" }}
{{- with $context }}
<div class="expand
{{- if $expanded }} expand-expanded{{ end -}}
">
2022-11-13 15:36:40 +00:00
{{- $c:=""}}{{/* things are getting complicated when search tries to open the expand box while jquery sets the display CSS on the element */}}
<a class="expand-label" onclick="$t=$(this); if($t.parent('.expand-expanded.expand-marked').length){ $t.next().css('display','none') }else if($t.parent('.expand-marked').length){ $t.next().css('display','block') }else{ $t.next('.expand-content').slideToggle(100); } $t.parent().toggleClass('expand-expanded');">
<i class="fas fa-chevron-down"></i>
2022-11-01 01:00:50 +00:00
<i class="fas fa-chevron-left expand-rtl direction-{{ $direction }}"></i>
<i class="fas fa-chevron-right expand-ltr direction-{{ $direction }}"></i>
{{ $title }}
</a>
<div class="expand-content" style="display:
{{- if $expanded }} block{{ else }} none{{ end -}}
;">
{{ $content | safeHTML }}
</div>
</div>
{{- end }}