Hi
In a special case i needed to have multiple photoswipe galleries on one page. Everything worked except when i clicked on an image in the second gallery, it opens the wrong image.
Example:
I have 2 Galleries. In the first Gallery there are 3 images, in the second 10. When i click on the second image in the first gallery everything is ok. When i click on the 5th image in the second gallery, it opens the 8th image in the second gallery.
The problem is, that the counter counts over all galleries and not only over the gallery, in which the clicked image is in.
I don't now if it is because i use different markup than usual. I use a view which fetches content from a type and displays a (multiple) image field. Then the field formatter is set to photoswipe.
Comment | File | Size | Author |
---|---|---|---|
#9 | photoswipe-multiple-2508091-9.patch | 696 bytes | gifad |
Comments
Comment #1
Cogax CreditAttribution: Cogax commentedComment #2
Cogax CreditAttribution: Cogax commentedI've made a small patch which works for me. It works if there are multiple galleries and also if there is only one.
Comment #3
Cogax CreditAttribution: Cogax commentedComment #4
Cogax CreditAttribution: Cogax commentedComment #5
jlockhartHaving the same problem; I have a view of nodes, each of which has a photoswipe gallery field. Applied the patch and alls well now. Thanks.
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedI think this approach would break people using
.photoswipe
CSS class independently. Seephotoswipe_admin_settings()
andphotoswipe_always_load_non_admin
variable's description.Comment #7
legolasboI think @ParisLiakos is correct and have adjusted the patch accordingly. It now checks if the clicked element is part of a gallery. If that is the case, it will look for the index within that gallery, otherwise it will look for the global index of the clicked element.
Comment #8
legolasboI've checked and found out that this bug is also applicable to 8.x-1.x. I have therefore changed the version to which this issue applies and tagged it as needs backport. The patch applies cleanly to both the 7.x and the 8.x branch, so it can be committed to both after RTBC.
Comment #9
gifad CreditAttribution: gifad commented#7 works fine, but it keeps the
index
variable defined (implicitly) as global; this is present in the current implementation, but is certainly not intended.The attached patch fixes that (and make the code a bit more concise..)
(applies to 7.x as well)
Comment #10
dcsambrook CreditAttribution: dcsambrook commented#9 Worked for me. Thank you.
Comment #11
davidam CreditAttribution: davidam commented#9 it's running to me, too!
Comment #12
vinmassaro CreditAttribution: vinmassaro commentedThe patch in #9 is working great in D7. Thanks!
Comment #13
igorski CreditAttribution: igorski as a volunteer commentedSince #9 fixes the Javascript, it works for D7 and D8. Please commit to D7 first or to both D7 and D8. Thanks!
Comment #14
idflorin CreditAttribution: idflorin commented#9 Worked for me. Test url http://bit.ly/2upbQMq
Comment #15
sun#2894797: Wrong image is opened with multiple galleries just fixed this for D8. Can you verify whether the same fix works in D7?
Comment #16
AnybodyWe need feedback if this is already fixed. See #15. I'll postpone it now.
Comment #17
arpas CreditAttribution: arpas as a volunteer commentedThe patch #9 worked for D7. Please contribute to D7.
Comment #18
arpas CreditAttribution: arpas as a volunteer commentedComment #20
AnybodyComment #22
Anybody#9 was committed to latest dev now. Please test it and provide feedback to have a new stable release afterwards.