Vitrinev1.0.4

Photo viewer

A library from npm, imported by its name through the import map.

The photos open in dialog-lightbox (opens in a new tab), a small photo viewer on the native <dialog> element. The script imports it as "dialog-lightbox", the way it reads after npm install; the site’s import map sends that name to jsDelivr, and params.stylesheets adds the library’s CSS.

live · Photo viewer
Diagonal bands of blue, orange, green and cream
Blue, orange and cream
A thin blue line between pale blue and navy
Pale blue and navy, split by a thin line
Dark teal over a thin orange stripe and orange
Teal over orange
Amber stripes across dark red
Amber stripes, upright
example.html
<div id="photos" class="figures">
  <figure>
    <a href="/media/photo-1-1600.jpg" data-dlb-width="1600" data-dlb-height="1066"><img src="/media/photo-1-480.jpg" alt="Diagonal bands of blue, orange, green and cream" /></a>
    <figcaption>Blue, orange and cream</figcaption>
  </figure>
  <figure>
    <a href="/media/photo-3-1600.jpg" data-dlb-width="1600" data-dlb-height="1066"><img src="/media/photo-3-480.jpg" alt="A thin blue line between pale blue and navy" /></a>
    <figcaption>Pale blue and navy, split by a thin line</figcaption>
  </figure>
  <figure>
    <a href="/media/photo-2-1600.jpg" data-dlb-width="1600" data-dlb-height="1066"><img src="/media/photo-2-480.jpg" alt="Dark teal over a thin orange stripe and orange" /></a>
    <figcaption>Teal over orange</figcaption>
  </figure>
  <figure>
    <a href="/media/photo-4-1600.jpg" data-dlb-width="1066" data-dlb-height="1600"><img src="/media/photo-4-480.jpg" alt="Amber stripes across dark red" /></a>
    <figcaption>Amber stripes, upright</figcaption>
  </figure>
</div>

Click a photo, then swipe or use the arrow keys; Escape or the back button closes it. The viewer is one <dialog> for the whole page: The dialog shows its markup and style. It runs bare here, without a frame:

/