explaingit

dimsemenov/photoswipe

25,165JavaScriptAudience · developerComplexity · 2/5MaintainedLicenseSetup · easy

TLDR

A lightweight JavaScript image gallery and lightbox that works on desktop and mobile without requiring any framework dependencies.

Mindmap

mindmap
  root((PhotoSwipe))
    What it does
      Image gallery overlay
      Touch gestures support
      Mobile and desktop
    Key features
      Modular architecture
      No dependencies
      Swipe and pinch-zoom
    Use cases
      Add galleries to websites
      Mobile-friendly lightbox
      Portfolio showcases
    Tech stack
      JavaScript
      Touch events
      CSS animations

Things people build with this

USE CASE 1

Add a touch-friendly image gallery to a website without installing a heavy framework.

USE CASE 2

Build a portfolio or photography site with swipe-to-navigate lightbox functionality on mobile and desktop.

USE CASE 3

Create a product showcase with pinch-to-zoom and gesture controls for better user experience.

Tech stack

JavaScriptCSSTouch API

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial, as long as you keep the copyright notice.

In plain English

PhotoSwipe is a JavaScript image gallery and lightbox for websites. A lightbox is the pattern where clicking a thumbnail opens a large version of the image in an overlay, and you can swipe or click through multiple images. PhotoSwipe is specifically designed to work well on both desktop browsers and mobile touchscreens, without depending on any JavaScript framework like React or Vue. The library is modular, meaning you import only the parts you need, and it has no external dependencies. It supports touch gestures like swipe and pinch-to-zoom on mobile devices and works independently of the page layout beneath it. This repository contains version 5, which represents a major rewrite. The source code lives in the src folder and the ready-to-use compiled files are in the dist folder. Documentation and a live demo are available at photoswipe.com. You would use PhotoSwipe when you want to add a polished image gallery experience to any website, particularly when you need it to look and feel good on phones as well as desktops, and when you want to avoid a dependency on a large UI framework.

Copy-paste prompts

Prompt 1
How do I add PhotoSwipe to my website and set up a basic image gallery with thumbnails?
Prompt 2
Show me how to customize PhotoSwipe's appearance and add my own CSS styling to the lightbox.
Prompt 3
How do I handle touch gestures like swipe and pinch-zoom in PhotoSwipe on mobile devices?
Prompt 4
What's the best way to integrate PhotoSwipe into a static HTML site without using a JavaScript framework?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.