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 $time) "-" }}
{{ $id := delimit (slice "gallery" .Ordinal) "-" }}
<div id="{{ $id }}">
{{ .Inner }}
</div>
<script>
$(document).ready(function () {
$(window).on("load", function () {
$('#{{ $id }}').packery({
percentPosition: true,
gutter: 5,