API
API
The browser module exports createLightbox and bindLightboxGallery. The React hook returns the same viewer.
| Name | Description |
|---|---|
createLightbox(options?) | Creates a viewer. Options include thumbnails, imageClick, doubleTapZoom, maxZoom, padding, className and icons. |
bindLightboxGallery(root, options?) | Opens every image inside root in the viewer, in page order. Its destroy also removes the click listener. |
open(items, index?) | Opens at an index. Items carry src, alt, caption, the natural size and an optional origin. |
close(), next(), prev(), goTo(index) | Moves through the set from code. Close returns to the origin thumbnail. |
zoomTo(scale, focus?), toggleZoom(focus?) | Zooms to a scale around a point, or between fit and the tap zoom. |
getState(), subscribe(listener) | Reads and listens to the index, zoom and open state. |
destroy() | Removes listeners and restores the page. |