FEATURE: pic set can support more than 9 pictures

This commit is contained in:
FarseaSH 2024-09-05 21:55:44 +08:00
parent ccad80501a
commit ad503162f2
3 changed files with 45 additions and 10 deletions

BIN
assets/more-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -360,6 +360,29 @@ $gray: #919EB1;
padding-bottom: 50%;
position: relative;
height: 0px;
&.img-black-filter::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgb(0, 0, 0);
opacity: 0.8;
}
.more-icon {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-size: 100% 100%;
z-index: 1;
}
}
img{

View file

@ -11,18 +11,30 @@
<div class="pic-grid" style="width: {{ $max_width }}%">
<div class="pure-g">
{{ range $num, $a := $pic_set }}
{{ if resources.Get $a }}
{{ $a = (resources.Get $a).Permalink }}
{{ end }}
<div class="pure-u-1-{{ $num_per_row }}">
<div class="add-padding">
<div class="img-container">
<a data-src="{{ $a }}" data-fancybox="gallery" data-caption="{{ $caption }}">
<img src="{{ $a }}" alt="pictures"/>
</a>
{{ if resources.Get $a }}
{{ $a = (resources.Get $a).Permalink }}
{{ end }}
{{ $display := "block"}}
{{ if gt $num 8 }} {{ $display = "none"}} {{ end }}
<div class="pure-u-1-{{ $num_per_row }}" style="display: {{$display}};">
<div class="add-padding">
{{ if and (eq $num 8) (gt (len $pic_set) 9) }}
<div class="img-container img-black-filter">
<a data-src="{{ $a }}" data-fancybox="gallery" data-caption="{{ $caption }}">
<div class="more-icon" style="background-image: url('{{ (resources.Get "more-icon.png").Permalink }}');"></div>
<img src="{{ $a }}" alt="pictures"/>
</a>
</div>
{{ else }}
<div class="img-container">
<a data-src="{{ $a }}" data-fancybox="gallery" data-caption="{{ $caption }}">
<img src="{{ $a }}" alt="pictures"/>
</a>
</div>
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
</div>