Improved object-position property handling
npm install @vovayatsyuk/photoswipe-object-positionObjectPosition — is a PhotoSwipe
plugin that improves object-position property handling when cropped thumbnails
are used.
1. Fixes thumbnail jumping animation while opening/closing lightbox.
2. Make sure that the initially zoomed image will show the same region of the image
as we saw in cropped thumbnail.
``js
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();
``