From bbe41da2efac50af491cc1d55a2d09b0273c10ce Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 12 Jan 2024 12:23:25 +0100 Subject: Fix static lightbox --- src/objects/_lightbox.scss | 14 +++++++++++--- tpl/objects/lightbox.pug | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/objects/_lightbox.scss b/src/objects/_lightbox.scss index 2af8b0a..93256a1 100644 --- a/src/objects/_lightbox.scss +++ b/src/objects/_lightbox.scss @@ -77,12 +77,20 @@ margin: auto; padding: fn.dim(--pad); - &:target { - display: block; + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: block; + } } - @include iro.bem-is('visible') { + @include iro.bem-multi('&:target', 'is' 'visible') { display: block; + + @include iro.bem-sibling-elem('img') { + @include iro.bem-modifier('default') { + display: none; + } + } } } diff --git a/tpl/objects/lightbox.pug b/tpl/objects/lightbox.pug index 5091565..633cf3f 100644 --- a/tpl/objects/lightbox.pug +++ b/tpl/objects/lightbox.pug @@ -8,6 +8,7 @@ mixin lightbox(images) +action-button(round=true quiet=true icon='x' class='o-lightbox__close-btn') each img, i in images img.o-lightbox__img(src=images[i] id='image-' + i) + img.o-lightbox__img.o-lightbox__img--default(src=images[0]) if images.length > 1 +action-button(round=true quiet=true icon='chevron-left' class='o-lightbox__nav-btn o-lightbox__nav-btn--prev') +action-button(round=true quiet=true icon='chevron-right' class='o-lightbox__nav-btn o-lightbox__nav-btn--next') -- cgit v1.2.3-70-g09d2