Rework lazy loading as js controlled fetches

This commit is contained in:
2026-01-28 13:20:35 +01:00
parent 80e3aa95d8
commit e6d6ad3c7b
2 changed files with 95 additions and 11 deletions

View File

@@ -88,7 +88,7 @@ class Output
$caption = $label;
}
// Build thumbnail URL - rely on native loading="lazy" for deferred loading
// Build thumbnail URL - JavaScript will load via fetch() for cancellability
$thumbUrl = $this->withQueryParams($url, [
'thumb' => 1,
'w' => $genThumbW,
@@ -107,12 +107,10 @@ class Output
. '>';
$renderer->doc .= '<img'
. ' class="luxtools-thumb"'
. ' src="' . $thumbSrc . '"'
. ' data-src="' . $thumbSrc . '"'
. ' alt=""'
. ' width="' . $thumbW . '"'
. ' height="' . $thumbH . '"'
. ' loading="lazy"'
. ' decoding="async"'
. ' />';
$renderer->doc .= '<span class="luxtools-gallery-caption">' . $caption . '</span>';
$renderer->doc .= '</a>';