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
  1. TB_TempArray = $("a[@rel="+imageGroup+"]").get();

to not include the @ sign in it ie.

New Thickbox Code
  1. 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 :)

Trackback URL for this post: http://www.stuffbysarah.net/2009/02/16/thickbox-and-jquery-131/trackback/
  • Sarfaraz Soomro Comments:

    Thanks this saved my couple hours?

  • laura Comments:

    this is awesome! so glad i found your fix. THANK YOU SO MUCH for posting!!!!!!!!

  • Molotok Comments:

    Thanks a lot. Half a day lost, but another half saved…

  • Keenora Comments:

    Awesome! You helped me alot with this tiny change :3

  • julie Comments:

    thank you so much! i've been looking everywhere for a solution! so so simple!

  • wouter Comments:

    Has anyone an idea to solve this in the minimized version?
    thanks!

  • Adam Comments:

    Thank you so much this saved me from a headache!

  • Jon Comments:

    THANKS A LOT !!

  • Karl Comments:

    Great stuff, saved me a lot of hassle.

  • David Comments:

    Thank you for this it saved me a lot of time.

  • Martin_X Comments:

    Thank You

  • karl Comments:

    I agree with everybody wasted hours trying to get it working with opencart, fixed in mins.

    Thankyou thankyou thankyou

  • Wies Comments:

    OMG what a find …. thanks so much!

  • Fletch Comments:

    Thanks Sarah.

    You're the tops!

  • Pingback: Fix The Rel Tag On Thickbox | The Musings of A Lost American

  • girish Comments:

    Nice fix……Thanks a lot……

  • Martin Comments:

    Thank you. Saved me hours of digging. Nice Post!

  • Rafael Comments:

    Thank you! Helped a lot here at work!!!

  • or Comments:

    Thanks!!! Very helpful!!

  • mati Comments:

    yeah!!!! remove the only @ in the compressed version, and get it working!!!

    THXS!

  • Satheesh Comments:

    Thanks a lot

  • Pingback: Fixed: Thickbox not working with multiple images « Sup-a-Dillie-O

  • Pingback: Thickbox being thick - Monio Design - Creative Coding of Wordpress sites

  • Oh yes Comments:

    Oh oui c'est bon ça !!
    Thank you very much for this.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *