fix slider
This commit is contained in:
parent
e50f71ec36
commit
71dd4d4d81
@ -12,10 +12,7 @@ topics:
|
|||||||
enable: false
|
enable: false
|
||||||
title: Kindersoldaten-Projekt
|
title: Kindersoldaten-Projekt
|
||||||
content: >
|
content: >
|
||||||
.
|
|
||||||
|
|
||||||
{{< slider dir="/media/schulchronik/Kindersoldaten-Projekt" >}}
|
{{< slider dir="/media/schulchronik/Kindersoldaten-Projekt" >}}
|
||||||
{{< slider dir="/media/schulchronik/2018/flashmob" >}}
|
|
||||||
|
|
||||||
**Projekt gegen den Einsatz von Kindersoldaten**
|
**Projekt gegen den Einsatz von Kindersoldaten**
|
||||||
|
|
||||||
|
@ -1,39 +1,25 @@
|
|||||||
|
{{ $dir := (.Get "dir") }}
|
||||||
|
{{ if $dir }}
|
||||||
<div class="card border-primary rounded-3">
|
<div class="card border-primary rounded-3">
|
||||||
<div class="carousel carousel-dark slide mb-0" data-bs-ride="true" id='slider-{{ md5 (.Get "dir") }}'>
|
<div class="carousel carousel-dark slide mb-0" data-bs-ride="true" id='slider-{{ md5 $dir }}'>
|
||||||
{{ $dir := (.Get "dir") }}
|
{{ $images := slice }}
|
||||||
{{ with $dir }}
|
{{ range readDir (print "/static/" $dir) }}
|
||||||
{{ $files := readDir (print "/static/" .) }}
|
{{ if (lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)") }}
|
||||||
<div class="carousel-indicators mb-0">
|
{{ $images = $images | append . }}
|
||||||
{{ range $index, $file := $files }}
|
|
||||||
{{ $isimg := lower $file.Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}
|
|
||||||
{{ if $isimg }}
|
|
||||||
{{ $linkURL := print $.Site.BaseURL "/" ($.Get "dir") "/" $file.Name | absURL }}
|
|
||||||
{{ if eq $index 0 }}
|
|
||||||
<button type="button mb-5" data-bs-target="#slider-{{ md5 $dir }}" data-bs-slide-to="{{ $index }}" class="active"></button>
|
|
||||||
{{ else }}
|
|
||||||
<button type="button mb-5" data-bs-target="#slider-{{ md5 $dir }}" data-bs-slide-to="{{ $index }}"></button>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
|
||||||
<div class="carousel-inner mb-0">
|
|
||||||
{{ range $index, $file := $files }}
|
|
||||||
{{ $isimg := lower $file.Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}
|
|
||||||
{{ if $isimg }}
|
|
||||||
{{ $linkURL := print $.Site.BaseURL "/" ($.Get "dir") "/" $file.Name | absURL }}
|
|
||||||
{{ if eq $index 0 }}
|
|
||||||
<div class="carousel-item mb-0 active">
|
|
||||||
<img src="{{ $linkURL }}" class="d-block w-100 mb-0 rounded-3">
|
|
||||||
</div>
|
|
||||||
{{ else }}
|
|
||||||
<div class="carousel-item mb-0">
|
|
||||||
<img src="{{ $linkURL }}" class="d-block w-100 mb-0 rounded-3">
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<div class="carousel-indicators mb-0">
|
||||||
|
{{ range $index, $image := $images }}
|
||||||
|
<button type="button mb-5" data-bs-target="#slider-{{ md5 $dir }}" data-bs-slide-to="{{ $index }}" {{ if eq $index 0 }}class="active"{{ end }}></button>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
<div class="carousel-inner mb-0">
|
||||||
|
{{ range $index, $image := $images }}
|
||||||
|
<div class="carousel-item mb-0 {{ if eq $index 0 }}active{{end}}">
|
||||||
|
<img src='{{ print $.Site.BaseURL $dir "/" $image.Name | absURL }}' class="d-block w-100 mb-0 rounded-3">
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
<button class="carousel-control-prev mb-0" type="button" data-bs-target="#slider-{{ md5 $dir }}" data-bs-slide="prev">
|
<button class="carousel-control-prev mb-0" type="button" data-bs-target="#slider-{{ md5 $dir }}" data-bs-slide="prev">
|
||||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||||
<span class="visually-hidden">Zurück</span>
|
<span class="visually-hidden">Zurück</span>
|
||||||
@ -44,3 +30,4 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
Loading…
x
Reference in New Issue
Block a user