如何使用$ .noConflict()解决Lightbox2问题? [英] How do I fix Lightbox2 problems using $.noConflict()?

查看:55
本文介绍了如何使用$ .noConflict()解决Lightbox2问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将图像导入到我的网站.我想用lightbox2打开这些图像.我已经安装了lightbox2-drupalmodule,并且可以在我的首页(www.chirowijkoersel.be)上使用,但是在导入图像的页面上却无法使用.

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确实适用于Opera.我还注意到lightbox2-module在Opera和其他所有浏览器的首页上为图像添加了一个类.

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.

链接:

我已经进行了一些研究,我认为问题是由$的多次使用引起的.我可以使用$ .noConflict()解决此问题.但是我需要把它放在哪里?

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?

推荐答案

包装您的JavaScript,并使用自动调用功能

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)

这篇关于如何使用$ .noConflict()解决Lightbox2问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆