dimsemenov / PhotoSwipe

JavaScript image gallery for mobile and desktop, modular, framework independent
http://photoswipe.com
MIT License
24.28k stars 3.31k forks source link

Re-index after jquery-UI sortable-action #999

Open DioVayne opened 9 years ago

DioVayne commented 9 years ago

First this: After the development of Fancybox (can I mention that here?) v3 halted I went looking for a touch-friendly lightbox and found Photoswipe and I must say: awesome!

I'm using Photoswipe in a homebrew-cms where the user can re-order the thumbnails in their albums. (I managed to prevent Photoswipe from opening when the user 'dragged' an image instead of clicked.)

The problem arising is that after re-ordering the thumbnails, the lightbox-versions doens't correspond to the thumbnails any longer. Is there a way the re-index or re-connect the PhotoSwipe images?

mjau-mjau commented 9 years ago

Not sure how you are creating the slides object (which indexes images in order), but that is done by example once an image is clicked. When an image is clicked, you create the slides object with indexes that correspond to the current sort order of images. If for some reason you have created the slides object prior to click, or if you are persistently storing it, you will need to make sure to re-create it after sortable.