Modifie l’agencement des onglets
This commit is contained in:
parent
b20b81e79e
commit
f445c8588d
90 changed files with 356 additions and 152 deletions
34
layouts/partials/scratch.html
Normal file
34
layouts/partials/scratch.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{ $folder := (print "/content/cinema/gallery/") }}
|
||||
{{ if .File }}
|
||||
{{ $folder = (print "/content/" .File.Dir "gallery/") }}
|
||||
{{ end }}
|
||||
{{ $img := newScratch }}
|
||||
{{ $files := readDir $folder }}
|
||||
{{ $img.Set "max" 0 }}
|
||||
{{ range sort $files "Name" "asc" }}
|
||||
{{ if not .IsDir }}
|
||||
{{ if not (in .Name "thumb") }}
|
||||
{{ $img.Add "list" (slice .Name) }}
|
||||
{{ $img.Set "max" (add ($img.Get "max") 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ range $index, $val := $img.Get "list" }}
|
||||
{{ $curr := index (split $val ".") 0 }}
|
||||
{{ $prec := mod (add (sub $index 1) ($img.Get "max")) ($img.Get "max") }}
|
||||
{{ $next := mod (add $index 1) ($img.Get "max") }}
|
||||
<a id="img{{ $index }}_h" class="thumb hidden_link" href="#img{{ $index }}">
|
||||
<picture>
|
||||
<source srcset="gallery/{{ $curr }}.thumb.avif" type="image/avif"/>
|
||||
<source srcset="gallery/{{ $curr }}.thumb.webp" type="image/webp"/>
|
||||
<img src="gallery/{{ $curr }}.thumb.jpg"/>
|
||||
</picture>
|
||||
</a>
|
||||
<!-- lightbox container hidden with CSS -->
|
||||
<div class="lightbox" id="img{{ $index }}">
|
||||
<a href="#img{{ $prec }}" class="light-btn hidden_link btn-prev"><<</a>
|
||||
<a href="#_" class="btn-close hidden_link">X</a>
|
||||
<img src="gallery/{{ $val }}">
|
||||
<a href="#img{{ $next }}" class="light-btn hidden_link btn-next">>></a>
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue