Thickbox 3.1 and jQuery - problem with rel
Thickbox has always worked well for me. Its simple, effective and classy. But recently while coding a new site I had problems trying to get image galleries to function. Thickbox would work fine until the rel parameter was added, then it would just sit there with the loading gif showing over and over... but no image (similar to what happens if you link to an image that doesn't exist, or you use the wrong path to the main image, etc).
rel is a simple thing in Thickbox, you just add rel="galleryName" inside your code, where galleryName is the name you want to group those particular photos with - ie:
<a href="/images/theImage.jpg" title="The Image" class="thickbox" rel="galleryName">
All images with the same rel (related is what I have always assumed rel to mean) tag will be shown in sequence using the next / last links in the popup.
Anyway, what I found after a lot of searching is a solution (thanks to http://www.stuffbysarah.net ) that is as simple as it is annoying. Simply locate line 79 of the code, and remove the '@' from the line, as follows, and it bursts back into life.
old line:
TB_TempArray = $("a[@rel="+imageGroup+"]").get();
change it to:
TB_TempArray = $("a[rel="+imageGroup+"]").get();
Oh - and if you use the compressed version, then search for this:
{E=$(”a[@1N="+g+"]
and change it to: (ie, just remove the @)
{E=$(”a[1N="+g+"]
Hope that helps someone... 

Nicely spotted
Good of you to share that.. I was having a mare trying to work out what was breaking it..
Post new comment