I love what you've done so far and so does my fiance!

I've installled lightbox on www.trphoto.co.za but we had a problem that, if you clicked on a thumbnail to enter a gallery, it would open that image instead of going into the gallery to see all the other images inside it.

I made a minor change to image_nodes.js that fixed it for us. I'm sure you can find a better way to do this but this is working really well and I thought you'd appreciate the suggestion plus code.

Before: (from about line 7)

                if (Element.hasClassName(nodes[i], "thumbnail")) {
                        var parent = nodes[i].parentNode;
                        parent.rel = "lightbox[node_thumbnails]";
                        parent.href = nodes[i].src.replace(".thumbnail", "");
                        parent.title = nodes[i].alt;
                }

Becomes:

                if (Element.hasClassName(nodes[i], "thumbnail")) {
                        var parent = nodes[i].parentNode;

                        // exclude gallery-ul
                        var ul = parent.parentNode.parentNode;
                        if (Element.hasClassName(ul, "images")) {
                                parent.rel = "lightbox[node_thumbnails]";
                                parent.href = nodes[i].src.replace(".thumbnail", "");
                                parent.title = nodes[i].alt;
                        }
                }

Works beautifully here: http://www.trphoto.co.za/image/tid/37

In case you're wondering why we'd want this, most people click on images to enter galleries so it just seemed the more intuitive route to go.

Enjoy!

Comments

stella’s picture

I think you might be able to achieve this by disabling a couple of the options on the lightbox2 configuration page, in particular the "Enable for Image Nodes" option.

Stella

stella’s picture

Assigned: Unassigned » stella
Status: Active » Fixed

Should be fixed in both lightbox2 4.7.x-1.0 and lightbox2 5.x-1.1. There is now an option on the lightbox2 settings page to disable the lightbox for images that are links to nested galleries.

Cheers,
Stella

stella’s picture

Status: Fixed » Closed (fixed)