ThickBox is a cool visualization tool based on Jquery JavaScript library. ThickBox helps you display photos in a cool way and is useful in many web projects.
–
The problem
ThickBox does not work when the HTML pages has other JavaScript libraries such as Mootools.
Debuging the error reveals this:
$(domChunk) is null
The solution
- Add this JavaScript in your page, just after you load the jQuery JavaScript-jQuery.noConflict();
- Replace every instances of ‘$’ with ‘jQuery’ in thickbox.js
This will make jQuery and ThinkBox play nice with other JavaScript libraries.
Thank You very much!! This is exactly what I needed
Thickbox with prototype and jquery same time…
Excellent !!! Good news for this morning
Greetings from France !!
Hi.
Have an asp:UpdatePanel
And when that is fired Thicbox don’t work anymore.
Tried the soluton mentioned abow, but no luck
this is exactly what i needed i have thickbox integrated in a project and i try to add an other lightbox plugin for the same page like a photo gallery but the two plugins was making a conflict i think because the two plugins have similar funcion names but if i add this chunk of code all works just as i expected.
A description of why this works is in order. Jquery defines what “$” means. so if you have another library that overwrites what “$” means, then your Jquery scripts won’t work.
When you use jQuery.noConflict(), it’s saying DON’T use $ for Jquery, instead use “jQuery”.
Seems to me jQuery and other libs needs to get their act together and stop trying to blow each other out of the water. Jquery should add “jQ” as the shorthand instead of “$” to prevent this, or at least add some sort of check to make sure “$” is still defined properly.
Very useful article. I was having throuble to start putting thickbox to work.
I just spend four hours. Worked first time.
This is Good Post…
my problem has solved by your post…
thanks….
God I love random blogging posts. Just saved me a load of time
Thanks! Going to bed sooner!
Worked like charm. Thanks.
It really saved my time. Thanks a lot Amir!
Awesome..!
If only I found this page earlier!
Thanks Amir
Yes, thank you very very much, I was thinking of jumping of a building because i couldn’t solve this one!!!! Greetings from the Netherlands!