allow to define aspect ratio

This commit is contained in:
2024-02-05 15:33:43 +01:00
parent 8217f0a6d8
commit e322408202
5 changed files with 7 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{{- $imgs := .imgs -}}
{{- $galno := .galno -}}
<div class="snap-gallery" style="--columns:{{ default 4 .columns }};--min-width:{{ default "200px" .minwidth }};--gap:10px;--cursor:{{ .cursor }};">
<div class="snap-gallery" style="--columns:{{ default 4 .columns }};--min-width:{{ default "200px" .minwidth }};--gap:10px;--cursor:{{ .cursor }};--aspectratio:{{ safeCSS (default "16/10" .aspectratio) }};">
{{- range $i, $img := $imgs -}}
<div class="snap-image">
<img src="{{ $img }}" onclick="openLightbox({{ $galno }});openLightboxItem({{ $galno }}, {{ add $i 1 }});">

View File

@@ -1,6 +1,6 @@
{{- $imgs := .imgs -}}
{{- $galno := .galno -}}
<div class="snap-slideshow" id="snap-slideshow-{{ $galno }}" style="--columns:1;--min-width:0px;--gap:0px;--slideshow-width:{{ default "100%" .width }};--cursor:{{ .cursor }};">
<div class="snap-slideshow" id="snap-slideshow-{{ $galno }}" style="--columns:1;--min-width:0px;--gap:0px;--slideshow-width:{{ default "100%" .width }};--cursor:{{ .cursor }};--aspectratio:{{ safeCSS (default "16/10" .aspectratio) }};">
{{- range $i, $img := $imgs }}
<div class="snap-image">
<div class="numbertext">{{ add $i 1 }} / {{ len $imgs }}</div>

View File

@@ -52,12 +52,12 @@
{{- $mode := default "gallery" .Params.mode -}}
{{/* Gallery mode */}}
{{- if eq $mode "gallery" -}}
{{- partial "gallery" (dict "columns" .Params.columns "minwidth" .Params.minwidth "imgs" $imgs "galno" $galno "cursor" $cursor) -}}
{{- partial "gallery" (dict "columns" .Params.columns "minwidth" .Params.minwidth "imgs" $imgs "galno" $galno "cursor" $cursor "aspectratio" .Params.aspectratio) -}}
{{/* Slideshow mode */}}
{{- else if eq $mode "slideshow" -}}
{{- partial "slideshow" (dict "imgs" $imgs "galno" $galno "width" .Params.slideshowwidth "cursor" $cursor) -}}
{{- partial "slideshow" (dict "imgs" $imgs "galno" $galno "width" .Params.slideshowwidth "cursor" $cursor "aspectratio" .Params.aspectratio) -}}
{{/* Set autorotate timer for slideshow, if configured (default: yes) */}}
{{- if .Params.slideshowrotate -}}
{{- if (default true .Params.slideshowrotate) -}}
<script>const autoSlideshow = setInterval(moveSlideshowItem, {{ default 5000 .Params.slideshowrotate_timer }}, {{ $galno }}, 1, "auto");</script>
{{- end -}}
{{- end -}}