JavaScript image gallery for mobile and desktop, modular, framework independent
Major update that changes initialization method!
Code quality and rewrite in ES6 The script is now distributed as an ES module and does not require a build step to use.
Simpler initialization and dynamic import support PhotoSwipe now supports dynamic import and does not block page rendering.
<script type="module">
import Lightbox from './photoswipe-lightbox.esm.js';
const lightbox = new Lightbox({
gallery: '#my-gallery',
children: 'a',
pswpModule: () => import('./photoswipe.esm.js')
});
lightbox.init();
</script>
Animation and gesture engine update Improved performance of most animations, touch gestures should feel more fluid now. The initial opening or closing transition can be run from cropped thumbnails.
Single CSS file and no external assets Using CSS variables, default icons are dynamically generated and tiny.
Built-in responsive images support PhotoSwipe also dynamically loads larger images as the user zooms via srcset.
Open images in zoomed state It's now much easier to control the zoom level.
Removed features from the core Some built-in features were removed in v5, either because they are using outdated technology or just rarely used. Some of them are or will be replaced by a plugin. These include:
This minor patch fixes issue with devices that have multiple types on input, running Windows 10 and Chrome (#1579). Larger update with improvements of API, certain parts of PhotoSwipe UI and functionality will hopefully be released in a near future (subscribe to get notified by email).
Fix: iOS 10.3 not updating layout after orientaton change in some cases. For more details please refer to issue https://github.com/dimsemenov/PhotoSwipe/issues/1315#issuecomment-291897591
fitControlsWidth
for the default UI (default was not changed – 1200px), issue #1021.:christmas_tree:
Improved rendering performance of images that are larger than PhotoSwipe viewport, which leads to more smooth swipe transition and decreased memory usage (up to 50% depending on image and viewport size), but affects zooming behaviour.
Composited layer for the image is now created only after it's zoomed. Watch screencast that demonstrates how it works now.
This change does not affect public API, everything should work as before.
Also some small things that were changed:
closeOnScroll
is now blocked if animations are running or gesture is performed.verticalDragRange
default value increased from 0.6 to 0.75.http://example.com/?gid=1&pid=your-custom-gallery-item-uid
. More info in FAQ section of docs. (via @csu & @kyleder).verticalDragRange
) (via @v-yanchevsky).direction:rtl
.bower.json
main
array with default ui (via @inlikealion).captionEl:false
.closeOnScroll
is now triggered only by mousewheel events and only in browsers that support transform. As various browsers trigger scroll event unpredictably (during page load, when bars appear, etc.).dist/
folder), not just in .scss files.clickToCloseNonZoomable
option.closeOnScroll:false
.More info in commit history.