JQuery is killing the lightbox

I just moved my javascript to jQuery for simple AJAX functions. However, I am trying to use a lightbox plugin with jQuery as I want to keep the same functionality, but don't want to include 10 different libraries. If I remove the jquery include and keep the lightbox it works fine if I return it it breaks it just displays the full size image instead of the window, neither chrome nor firefox console complain about anything, it just goes straight to the image I tried using 5 different clones / plugins for jQuery, but they all gave me the same behavior which made me think I was missing something

right now my headers look like this (double checked, they're all there):

<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/thickbox.js'></script>
<link rel='stylesheet' type='text/css' href='css/thickbox.css' />

      

and my gallery (php):

foreach(...){
echo "<a href=\"$path\" class='thickbox' rel='$folder'><img border=none src=\"$thumb\" /></a>&nbsp;\n" ;
}

      

for the background, the images in the foreach are loaded from the ajax call, but that was never a problem for lightbox, it shouldn't be because all the html is all the same

+2


source to share


5 answers


This usually happens because other libraries (not jQuery) also try to use the dollar sign variable name.



JQuery has an option to enable compatibility mode that will force you to use jQuery () instead of $ () to call jQuery.

+3


source


You can also use jQuery Lightbox Plugin



+3


source


Just a thought ... is LightBox trying to include its own copy of jQuery or something similar? IIRC, this could be the cause of your problems ...

0


source


Try looking at Shadowbox . It has the same effect, but I had no problem with JQuery. They also have very similar settings and are fairly easy to switch between.

0


source


You can find various ways to resolve the conflict here: Using_jQuery_with_Other_Libraries

0


source







All Articles