PhotoSwipe adds responsive image galleries and lightboxes to sites on mobile and desktop. It ships as a framework-agnostic JavaScript module.
Overview
PhotoSwipe is a JavaScript image gallery and lightbox for web pages. It targets both mobile and desktop browsers and is designed to work without tying you to a specific UI framework.
Version 5 distributes the script as an ES module that you can load without a bundler step. Initialization supports dynamic imports so the gallery can load on demand instead of blocking page render.
Touch gestures and animations were reworked for smoother interaction. Opening and closing can animate from a CSS-cropped thumbnail. A single CSS file carries styling, with default icons generated via CSS variables.
Built-in support loads larger images through srcset as users zoom, and you can open slides already zoomed. Optional plugins add dynamic caption placement and experimental tiled deep-zoom viewing for very large images.
Some older built-in features such as hash-based history navigation, social sharing, fullscreen controls, and inline gallery mode were removed from the core in favor of a dialog-focused lightbox model.
Key features
- ES module lightbox distribution
- Dynamic import initialization
- Touch gesture navigation
- Responsive srcset zoom loading
- Thumbnail-based open animations
- CSS-variable icon styling
- Optional caption positioning plugin
- Tiled deep-zoom plugin
Use cases
- Portfolio and photography sites
- Product image lightboxes
- Mobile-friendly media galleries
- Large artwork zoom viewing
- Documentation and demo pages