Overview

Lightbox

An image viewer that grows out of the thumbnail and zooms into the detail.

Get started

Click an image, then ←→ to page, +− to zoom, Esc to close.

Principles

  • Page with native scroll snap. Pages are a scroll-snap strip from the carousel, so touch and trackpads keep the system's momentum.

  • Open from the thumbnail and return to it. The image grows out of its cropped preview and goes back to the same place on close.

  • Load only what is near. Only the current and neighboring images load, and a long jump skips the pages in between.

  • Zoom around the point you touch. Pinch, wheel and double-tap zoom around the pointer or fingers, and panning stops at the image's edges.

  • Keep focus inside and give it back. The viewer is a native modal dialog, and closing it returns focus to the element that opened it.

  • Leave the page as it was. Destroy restores the page scroll, the hidden thumbnail, and every style and listener the viewer touched.