25.3K ·GitHub
What is this?
PhotoSwipe is a JavaScript image gallery and lightbox for mobile and desktop — modular, framework-independent code you add to your own web pages.
Is this a library I add to my own site, or a hosted gallery service?
It's a front-end library, not a service: you include its JavaScript and CSS in your page and attach it to your own markup. It works without any particular framework.
How do I add it to a webpage?
Prebuilt files ship in the dist/ folder — take the main JS and CSS from there and include them in your page. To rebuild them from src/, run npm run build.
Does it need jQuery or a framework like React to work?
No. The package has zero runtime dependencies and is framework independent, so it drops into plain HTML as easily as into a React or Vue project.
There are tons of old PhotoSwipe tutorials around — which version is current?
v5 is the current version. v6 is in development and the author is asking for feedback on the upcoming changes, while docs and code for v4 (4.1.3) remain available for legacy projects.
Will it behave the same on phones and desktop browsers?
It is built for both mobile and desktop, and the project is tested with BrowserStack across browsers.
What is the difference between PhotoSwipe Core and PhotoSwipe Lightbox?
The source ships two entries: src/js/photoswipe.js for PhotoSwipe Core — the gallery engine itself — and src/js/lightbox/lightbox.js for PhotoSwipe Lightbox, a ready-to-use wrapper built on top of it.
Is the project still being actively developed?
Yes. Work on v6 is underway with the author requesting community feedback, the codebase is regularly tested through BrowserStack, and the project has been around since 2011 with roughly 25k GitHub stars.
What are similar projects?
Magnific-Popup, swiper, pdf.js, drawably, dropzone, material, sweetalert2, pure
Which topics is it in?
viewer, modular, gallery, photos, zero-dependency, image, javascript-library, ui-components, css, browser, mobile, ui