Gallery fixes.

- Fixed having multiple galleries in the same page with the same ID, which would cause the galleries after the first one not behaving correctly.
- Make sure that all images have finished loading before calling Packery, fixing some image overlapping problems.
This commit is contained in:
MaikelChan 2023-05-23 20:20:07 +02:00
parent 3c0d54c41d
commit 83eae55276
No known key found for this signature in database
GPG key ID: B2CE398C279239EC

View file

@ -1,12 +1,11 @@
{{ $time := now.UnixNano }} {{ $id := delimit (slice "gallery" .Ordinal) "-" }}
{{ $id := delimit (slice "gallery" .Ordinal $time) "-" }}
<div id="{{ $id }}"> <div id="{{ $id }}">
{{ .Inner }} {{ .Inner }}
</div> </div>
<script> <script>
$(document).ready(function () { $(window).on("load", function () {
$('#{{ $id }}').packery({ $('#{{ $id }}').packery({
percentPosition: true, percentPosition: true,
gutter: 5, gutter: 5,