- Lightbox custom avec Swiper (pas de nouvelle dépendance) - Déclenché sur les figures éligibles uniquement (exclut figures dans <a> et dans les cards avec .link-block) - Galeries : ouvre toutes les slides au bon index - Fermeture : bouton ✕, clic overlay, Echap - Captions : figcaption, p.caption (dans figure ou sibling) - Cursor zoom-in desktop uniquement via figure[data-lightbox] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
81 lines
1.5 KiB
SCSS
81 lines
1.5 KiB
SCSS
#lightbox {
|
|
position: fixed;
|
|
inset: 0;
|
|
z-index: calc(var(--z-header) + 10);
|
|
background-color: rgba(0, 0, 0, 0.92);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
pointer-events: none;
|
|
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
|
|
body.lightbox-open & {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
pointer-events: auto;
|
|
}
|
|
}
|
|
|
|
#lightbox-close {
|
|
position: absolute;
|
|
top: var(--padding-body);
|
|
right: var(--padding-body);
|
|
background: none;
|
|
border: none;
|
|
color: var(--color-txt);
|
|
cursor: pointer;
|
|
padding: 8px;
|
|
z-index: 1;
|
|
line-height: 0;
|
|
|
|
svg {
|
|
width: 30px;
|
|
fill: var(--color-txt);
|
|
transition: fill 0.2s ease;
|
|
}
|
|
|
|
&:hover svg {
|
|
fill: var(--grey-400);
|
|
}
|
|
}
|
|
|
|
#lightbox-swiper {
|
|
width: 90vw;
|
|
|
|
.swiper-slide {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
figure {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
cursor: default;
|
|
|
|
img {
|
|
max-width: 90vw;
|
|
max-height: calc(90dvh - 100px);
|
|
width: auto;
|
|
height: auto;
|
|
object-fit: contain;
|
|
}
|
|
|
|
figcaption {
|
|
margin-top: calc(var(--spacing) * 0.5);
|
|
color: var(--color-txt-light);
|
|
font-size: var(--fs-small);
|
|
text-align: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Cursor zoom-in sur les figures éligibles — desktop uniquement
|
|
@media (min-width: 1080px) {
|
|
figure[data-lightbox] {
|
|
cursor: zoom-in;
|
|
}
|
|
}
|