I have a galleria set up to show the main image in Lightbox2 when it is clicked. If I click on the thumbnail of an image, then click on the larger image to show it in lightbox it says it is image 1 of __. If I click on next in lightbox it then goes to the 1st image instead of continuing on from the current one.

If I open the 3rd image it should say image 3 of __ in the lightbox. If I click next it should continue to the 4th one, not go to the first one.

CommentFileSizeAuthor
#2 galleria_lightbox_order.patch2.38 KBeromba

Comments

roger6106’s picture

Title: Lightbox image order is not consistent » Lightbox shows whichever picture was clicked on as image 1
Priority: Normal » Minor
Status: Fixed » Active

Example galleria here: [removed]

Try clicking on the thumbnail of the 3rd picture, then on the main image. The lightbox that opens will say image 1 of 9 when it should say image 3 of 9. If you click next it will say image 2 of 9 and show the first picture. It should show the 4th picture and say image 4 of 9.

eromba’s picture

Title: Lightbox shows whichever picture was clicked on as image 1 » Lightbox image order is not consistent
Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new2.38 KB

Thanks for reporting this one, Roger. It looks like I took the wrong approach when I originally implemented this feature--I treated the main image as another lightbox-enabled image and had the Lightbox2/jQuery Lightbox module rescan the page every time that image changed. Since the main image comes before the rest of the thumbnails, however, it always appears as "1 of __" like you described.

The right approach is to make the main-image onclick action reference the corresponding thumbnail. That way, the images will appear in the same order in the lightbox.

Luckily, the fix isn't very involved, and now the lightbox module won't have to rescan the page each time you change images.

The patch is attached. I've tested it successfully with jQuery Lightbox and the latest dev version of Lightbox2.

Mark Theunissen’s picture

Cool thanks! Does it require that dev version? Or is that just the one you used for testing?

eromba’s picture

The 6.x-1.9 release of Lightbox2 seemed have a lot of behavioral issues (on its own, not just regarding Galleria integration) that went away when I upgraded to the latest dev version, but I have the feeling it was due to my configuration and/or conflicts with other modules. Technically, the patch should work just as well with Lightbox2 6.x-1.9. Let me know how your testing goes.

Mark Theunissen’s picture

Is there any reason why the variable num_thumbs is outside the options in the global scope?

I've moved it into the options namespace and everything seems to work fine:

/**
 * Configuration options for the Galleria.
 */
Drupal.galleria.options = {
  num_thumbs : 1,
  insert : '#main-image',
eromba’s picture

@Mark: No particular reason. I was just cranking out this patch in a hurry. ;)

Mark Theunissen’s picture

Status: Needs review » Fixed

Committed to -dev. Thanks!

roger6106’s picture

Title: Lightbox shows whichever picture was clicked on as image 1 » Lightbox image order is not consistent
Priority: Minor » Normal
Status: Active » Fixed

I'm using Lightbox2 6.x-1.9 after updating to the latest Galleria dev, and it works great. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.