I always liked the syntax simplicity of jQuery yet felt the needs of Prototype library in addition to jQuery goodness. Unfortunately had to always keep them apart due to syntax conflict, the use $ in two different manner. Imagine the power of jQuery and Prototype harnessed together into you application, nothing but sleek and smooth stuffs.
But hey that isn’t a day dreaming any more, looks like the folks at jQuery figured out a way to use their library with other JS libraries, primarily with Prototype library (MooTools works like magic as well). Well what’s the solution? Very simple actually, some adjustment in your script declaration order and a jQuery function call jQuery.noConflict().
They mentioned several ways to getting the job done, but the bottom line is just straight:
1) In document head Library declaration jQuery will be last in order (after Prototype/MooTools etc.)
2) Replace “$”, which used as a short cut for “jQuery” to something else that won’t conflict with other library(s).
On your document head section your declaration should look something like this (make sure you change the location of your script as necessary):
< script src="prototype.js">< /script>
< script src="jquery.js">< /script>
< script> jQuery.noConflict();< /script>
Now open up the thickbox.js place the following code just below “var tb_pathToImage=…….”
Almost done here, now scroll at the end of the file and place ”})(jQuery);” . That’s about it, unless you got any other jQuery function calls somewhere in the document body. This simple peace of trick allow you to use scriptaculous and thickbox seamlessly by changing jQuery function short cut from $ to “jQuery”. See that wasn’t so bad after all. 🙂