dialog-lightboxv0.3.1

Styling

The library reports its state as attributes and custom properties.

On the dialog

AttributeSet when
data-dlb-typeimage or video, for the current slide
data-dlb-first, data-dlb-lastAt either end
data-dlb-loading, data-dlb-errorThe large file is loading or failed
data-dlb-zoomable, data-dlb-zoomedThe photo can zoom, or is zoomed
data-dlb-ui-hiddenAfter a tap on a photo, to hide your buttons
data-dlb-paused, data-dlb-muted, data-dlb-noaudioThe video’s state
data-dlb-animatingDuring the opening and closing zoom and the drag down
data-dlb-movingWhile anything moves

Custom properties

Custom property
--dlb-opacityFrom 0 to 1 while the box opens, and back while it closes, for the backdrop
--dlb-progressOn progress bars, from 0 to 1
--dlb-media-x, -y, -width, -heightThe rectangle where the current photo or video rests

The current slide has data-dlb-current, and the others are inert.

Example

style.css
dialog[data-dlb]::backdrop {
  background: rgb(0 0 0 / var(--dlb-opacity));
}

dialog:not([data-dlb-type="video"]) .video-bar {
  display: none;
}