diff --git a/assets/js/script.js b/assets/js/script.js index b8084d4..20301c3 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -13,8 +13,6 @@ document.addEventListener("DOMContentLoaded", () => { images: document.querySelectorAll("img"), }; - console.log(nodes.images); - // Listeners nodes.burgerBtn.addEventListener("click", () => expandNav(nodes)); nodes.closeNavBtn.addEventListener("click", () => closeNav(nodes)); @@ -23,15 +21,17 @@ document.addEventListener("DOMContentLoaded", () => { jsLink.addEventListener("click", () => (location.href = to)); }); - nodes.images.forEach((image) => { - if (image.complete) { - show(image); - } else { - image.addEventListener("load", () => { + setTimeout(() => { + nodes.images.forEach((image) => { + if (image.complete) { show(image); - }); - } - }); + } else { + image.addEventListener("load", () => { + show(image); + }); + } + }); + }, 100); // Key shortcuts window.addEventListener("keyup", (event) => { diff --git a/site/config/config.php b/site/config/config.php index 5277ef5..b9642d8 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -5,28 +5,15 @@ return [ 'thumbs' => [ 'quality' => 80, 'presets' => [ + 'grid' => 400, 'default' => [ 'width' => 1024, 'format' => 'webp' ], - 'full' => 2048, 'format' => 'webp' + 'full' => 2048, + 'format' => 'webp' ], 'srcsets' => [ - 'default' => [ - '200w' => ['width' => 400], - '400w' => ['width' => 800], - '800w' => ['width' => 1600], - '1024w' => ['width' => 2048], - '1440w' => ['width' => 2880], - '2048w' => ['width' => 4096] - ], - 'webp' => [ - '200w' => ['width' => 400, 'format' => 'webp'], - '400w' => ['width' => 800, 'format' => 'webp'], - '800w' => ['width' => 1600, 'format' => 'webp'], - '1024w' => ['width' => 2048, 'format' => 'webp'], - '1440w' => ['width' => 2880, 'format' => 'webp'], - '2048w' => ['width' => 4096, 'format' => 'webp'] - ] + 'default' => [200, 400, 600, 800, 1024, 1440, 2048], ], ], 'panel' => [ diff --git a/site/snippets/event-card.php b/site/snippets/event-card.php index 081ec87..4cb6a22 100644 --- a/site/snippets/event-card.php +++ b/site/snippets/event-card.php @@ -3,20 +3,21 @@
gallery()->toFiles()->count() > 1): ?> $event->gallery()->toFiles()->first(), - 'class' => 'image-cover' + 'file' => $event->gallery()->toFiles()->first()->thumb('grid'), + 'class' => 'image-cover', + 'size' => (100 / (12 / $span) - 10) ]) ?> gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first(); - snippet('picture', ["file" => $file]); + snippet('picture', ["file" => $file, 'size' => (100 / (12 / $span) - 10)]); ?>
title() ?>
isMapadoEvent() == 'true'): ?> - option('ticketingUrl') . 'event/' . $event->mapadoSlug()]) ?> + option('ticketingUrl') . 'event/' . $event->mapadoSlug(), 'size' => (100 / (12 / $span) - 10)]) ?>
diff --git a/site/snippets/picture.php b/site/snippets/picture.php index 3a61e65..cfcb3ce 100644 --- a/site/snippets/picture.php +++ b/site/snippets/picture.php @@ -1,6 +1,6 @@ alt(); $crop = $crop ?? false; @@ -10,6 +10,7 @@ $width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width(); $height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height(); $class = isset($class) ? 'class="' . $class . '"': ''; + $lazy = $lazy ?? true; ?> @@ -25,7 +26,7 @@ width="" height="" alt="" - loading="lazy" + >
diff --git a/site/templates/home.php b/site/templates/home.php index 46323b8..6268516 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -9,10 +9,10 @@
heroLinkUrl()->isNotEmpty() == 'true'): ?> - $site->heroImage()->toFile()]) ?> + $site->heroImage()->toFile(), 'lazy' => false, 'size' => 50]) ?> - $site->heroImage()->toFile()]) ?> + $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>