dialog-lightboxv0.3.1

Getting started

Install the library, link your photos and add one dialog.

Install

sh
npm install dialog-lightbox

Each thumbnail links to its large file, so the page works without JavaScript. One dialog with a viewport serves every gallery on the page.

index.html
<div class="gallery">
  <a href="ferry-1600.webp"><img src="ferry-480.webp" alt="The ferry at Kiel" /></a>
  <a href="ride.mp4" data-dlb-type="video"><img src="ride-poster.webp" alt="Riding to the ferry" /></a>
</div>

<dialog aria-label="Photo viewer">
  <div data-dlb-viewport></div>
  <button type="button" data-dlb-close>Close</button>
</dialog>

Start it

script.js
import { lightbox } from "dialog-lightbox";
import "dialog-lightbox/dialog-lightbox.css";

lightbox({ gallery: document.querySelector(".gallery"), dialog: document.querySelector("dialog") });

The examples show one feature each, running live next to their code.