PhotoSwipe
ObjectPosition plugin forObjectPosition — is a PhotoSwipe
plugin that improves object-position
property handling when cropped thumbnails
are used.
Improvements
- Fixes thumbnail jumping animation while opening/closing lightbox.
- Make sure that the initially zoomed image will show the same region of the image as we saw in cropped thumbnail.
Usage
import PhotoSwipeLightbox from '/assets/photoswipe/dist/photoswipe-lightbox.esm.js';
import ObjectPosition from '/assets/photoswipe-object-position.js';
const lightbox = new PhotoSwipeLightbox({
gallery: '#my-gallery',
children: 'a',
pswpModule: () => import('/assets/photoswipe/dist/photoswipe.esm.js')
});
new ObjectPosition(lightbox);
lightbox.init();