Thickbox and jQuery 1.3.1
I’ve recently been finishing off a site where I needed a lightbox to simplify showing several photos for each product. I’ve used Thickbox in the past, as it comes with WordPress by default, however this is a custom built site. I already had the latest version of jQuery running for other functions on the site, so just needed to grab a copy of thickbox, upload that, add the necessary code and that should be that.
3 hours of going around in circles later… and still no joy! After checking over my code piece by piece, trying the code out of WordPress, trying the page on another server just in case, and trying every other option I could think of, I finally tried uploading jQuery 1.2.6 from my WordPress 2.7 folder on my computer, and hey presto, it all worked!
It seems that there is a minor change required for thickbox to work with the latest jQuery version. After a bit of searching around I found out that what’s needed is on line 79 of the existing thickbox file you need to change the line
- Existing Thickbox Code
- TB_TempArray = $(“a[@rel=”+imageGroup+”]”).get();
to not include the @ sign in it ie.
- New Thickbox Code
- TB_TempArray = $(“a[rel=”+imageGroup+”]”).get();
Such a simple change that caused a few hours of frustration! So hopefully it may be of use to someone else 🙂