Skip to content

Instantly share code, notes, and snippets.

@Agurato
Created July 2, 2020 15:22
Show Gist options
  • Save Agurato/35819571d439b5294641638b2290ef67 to your computer and use it in GitHub Desktop.
Save Agurato/35819571d439b5294641638b2290ef67 to your computer and use it in GitHub Desktop.
Hugo shortcode for expendable content
<span class="expand">
<span class="expand-label" style="cursor: pointer;" onclick="$h = $(this);$h.next('div').slideToggle(100,function () {$h.children('i').attr('class',function () {return $h.next('div').is(':visible') ? '{{.Get 2 | default `fas fa-chevron-down`}}' : 'fas fa-{{.Get 1 | default `fas fa-chevron-right`}}';});});">
{{.Get 0}}
<i class="{{.Get 1 | default `fas fa-chevron-right`}}"></i>
</span>
<div class="expand-content" style="display: none; margin: 10px 0px 10px">
{{.Inner | safeHTML}}
</div>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment