arnowelzel/photoswipe-fullscreen

Full screen Icon repeated

feguensp opened this issue · 4 comments

Every time a new picture is selected to launch photoswipe light box a new Full screen button is added.
Screenshot 2022-10-04 220158

Do you have an URL for demonstration? What do you mean with "Every time a new picture is selected to launch photoswipe"?

I don't understand the problem and can not reproduce it. See my working example here: https://arnowelzel.de/samples/photoswipe5/

And furthermore the use as part of my WordPress plugin: https://wordpress-demo.arnowelzel.de/lightbox-with-photoswipe-5-overlay-caption/

Edit: ok, got it - when building PhotoSwipe using the selector initialization, it seems that the plugin is called multiple times and not only once.

However - this looks like a bug in PhotoSwipe as it works fine with the WordPress integration where not PhotoSwipe is responsible to build the image collection but another frontend script.

When you click on the first picture than you close it, then you click any other picture, a new full screen icon is displayed. So you get two icons to toggle full screen.
Screenshot 2022-10-04 234620

I added a workaround to only add the UI element if it is not added already. It seems, Photoswipe calls init and uiRegister multiple times after it was opened once.

Closed with 3a5c153