About this set
Two lightbox galleries that open a photo large over the page. Photo grid that opens a lightbox shows six wedding photographs as 4:3 thumbnails with an enlarge icon; activating one opens a full-screen viewer with the photo, its caption, a 2 of 6 counter, previous and next buttons and a close button. Article images that open full screen puts two wildlife photos inside a short field diary entry, the click-to-enlarge pattern for blog posts and case studies, using the same viewer. The plain CSS and Tailwind versions use the native dialog element with showModal(), so the browser traps focus inside it and closes it on Esc; a short vanilla script fill in the photo, step through the set with the arrow keys or buttons, close it on a click on the dark area and return focus to the thumbnail of the photo you were looking at. The Bootstrap version is a .modal-fullscreen in the dark theme, opened with data-bs-toggle and filled from the thumbnail that opened it. Every thumbnail is a real link to the large photo, so without the script it still opens the picture.
What’s included
- Full-screen viewer with caption, counter, arrows and a close button
- Arrow keys step through the photos and Esc closes
- Native <dialog> with showModal() in the CSS and Tailwind versions
- Bootstrap version built on .modal-fullscreen with data-bs-theme="dark"
- Thumbnails are links to the large photo, so they work without JavaScript
Accessibility
The viewer is a modal dialog named by the photo caption, focus moves into it on open and cannot leave it until it closes, and it closes with Esc, the labelled close button or a click on the dark area. Focus then returns to the thumbnail of the last photo shown. The large image gets the same descriptive alt text as its thumbnail, and every button has a name such as Next photo. The open animation and thumbnail zoom stop under prefers-reduced-motion.
Customise it
Change the backdrop colour in .lb-dialog::backdrop, the button colours in .lb-btn and the thumbnail columns in .lbg-grid. In Bootstrap restyle .lb-modal .modal-content; in Tailwind edit the backdrop: and bg-white/14 utilities on the dialog and its buttons.





