Skip to content
Advertisement

Photoswipe opens only first or second image

I need to have every two of images in gallery embed with extra <div>. I managed Photoswipe to use all images in that gallery. But I can’t fix problem: when I click on any thumb (not first or second one), Photoswipe every time opens only first or second image from firs <div>.

Codepen DEMO here

JavaScript

Thank you for any advice on solving this.

Advertisement

Answer

I modified the default Photoswipe Codepen Example to work with open Images at a custom Index. Here is the Codepen Example how to open a Custom Picture on Event Click

JavaScript

With the Method

JavaScript

you can open the Picture with the Index you want.

Advertisement