fix: revert srcset on beforeafter images

Le srcset sur image-before/image-after perturbait le clip CSS
(width: var(--position)) rendant l'effet before/after inopérant.
On revient aux img simples (src only) pour garantir le bon fonctionnement
du slider.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-02-27 14:45:43 +01:00
parent a1fda065a9
commit 94065f1ce6
2 changed files with 1 additions and 14 deletions

View file

@ -3,11 +3,6 @@
$imageBefore = $block->imageBefore()->toFile();
$imageAfter = $block->imageAfter()->toFile();
$caption = $block->caption()->value();
$imgSizes = $imgSizes ?? '(min-width: 768px) 50vw, 90vw';
$imgSrcset = $imgSrcset ?? 'body-half';
$kirbyThumbs = kirby()->option('thumbs.srcsets', []);
$srcsetAttr = isset($kirbyThumbs[$imgSrcset]) ? fn($f) => $f->srcset($imgSrcset) : fn($f) => $f->srcset();
?>
<?php if ($imageBefore || $imageAfter): ?>
@ -16,16 +11,12 @@ $srcsetAttr = isset($kirbyThumbs[$imgSrcset]) ? fn($f) => $f->srcset($imgSrcset
<?php if ($imageBefore): ?>
<img class="image-before slider-image"
src="<?= $imageBefore->url() ?>"
srcset="<?= $srcsetAttr($imageBefore) ?>"
sizes="<?= $imgSizes ?>"
alt="<?= $imageBefore->alt()->or('Image avant')->esc() ?>" />
<?php endif ?>
<?php if ($imageAfter): ?>
<img class="image-after slider-image"
src="<?= $imageAfter->url() ?>"
srcset="<?= $srcsetAttr($imageAfter) ?>"
sizes="<?= $imgSizes ?>"
alt="<?= $imageAfter->alt()->or('Image après')->esc() ?>" />
<?php endif ?>
</div>

View file

@ -221,11 +221,7 @@ $dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
<?php elseif ($block->type() === 'beforeafter'): ?>
<div class="media">
<?php snippet('blocks/' . $block->type(), [
'block' => $block,
'imgSizes' => '100vw',
'imgSrcset' => 'body-full',
]) ?>
<?php snippet('blocks/' . $block->type(), ['block' => $block]) ?>
</div>
<?php elseif ($block->type() === 'video'): ?>