Search code examples
javascriptdrupalpicasalightbox2

How do I fix Lightbox2 problems using $.noConflict()?


I've imported images to my site. I want to open these images with lightbox2. I've installed the lightbox2-drupalmodule and that works on my frontpage (www.chirowijkoersel.be), but it doesn't work on the pages where I imported images.

Lightbox does work with Opera. I've also noticed that the lightbox2-module adds a class to the images in Opera and on the frontpage with every other browser.

Links:

Edit: I've done some research, and I think the problem is caused by the multiple use of $. I can solve this by using $.noConflict(). But where do I need to put this?


Solution

  • Wrap of you javascript, and use self invoking functions

    (function($){
    
          /// Your page code here
          // Here you can use $ 
          // We are passing jquery as $ to this self invoking function.
    })(jquery)