StealThis .dev

Photography — Gallery Lightbox

A gallery-dark, image-first lightbox component with a responsive thumbnail grid that opens into a full-bleed overlay. Click any frame to launch a backdrop-blurred viewer with prev/next controls, keyboard arrows and Esc, a live counter like 3/12, and a typographic caption strip. Built with vanilla JS, focus trapping, and buttery micro-interactions — drop it into any photographer portfolio or editorial spread.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

A reusable, dependency-free lightbox built for photographers and editorial galleries. The landing view is a masonry-leaning thumbnail grid where each frame is a full-bleed image with a thin uppercase label and a subtle zoom-on-hover. Everything sits on a deep gallery-dark surface so the photography does the talking, with generous whitespace and a display serif for the headings.

Click any thumbnail — or focus it and press Enter — and the lightbox lifts into view over a blurred, dimmed backdrop. The overlay shows the image large and centered, a caption strip with the photo title, location and photographer credit, and a live counter reading the current position such as 3 / 12. Left and right arrow buttons page through the set; wrapping is enabled so you loop cleanly from the last frame back to the first.

Keyboard support is first-class: arrow keys navigate, Esc closes, and Tab is trapped inside the overlay so focus never escapes to the page behind it. Opening the lightbox locks body scroll and remembers the thumbnail you came from, restoring focus to it on close. A tiny toast helper confirms actions, and the whole thing degrades gracefully down to a single-column grid at ~360px.