TypeError:“未定义"不是函数(评估"$(“.fancybox").fancybox()') [英] TypeError: 'undefined' is not a function (evaluating '$(".fancybox").fancybox()')

查看:77
本文介绍了TypeError:“未定义"不是函数(评估"$(“.fancybox").fancybox()')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在使用我的网站的新版本,但无法正确加载精美的框:

Working on a new version of my site but can't get fancy box to load properly:

http://www.taintmovie.com/storecartloom2/

我检查了对jquery的重复调用,但未发现任何重复调用.

I checked for duplicate calls to jquery, but did not see any.

推荐答案

更多地研究问题,不是fancybox.js文件的打包版本如先前建议那样被破坏(我将文件与fancybox网站,并且它们匹配.)

Digging a little bit more into the issue, is not the packed version of the fancybox.js file that is broken as previously suggested (I compared the file with the fancybox website and they matched.)

为了摆脱错误并使fancybox正常工作,您必须在网站中修复三件事:

There are three things you have to fix in your website in order to get rid of the error and make fancybox to work properly:

1).关闭您的<head>标签(当前没有</head>关闭标签)

1). Close your <head> tag (currently there is not </head> closing tag)

2).您说您检查了jQuery重复项,但正在加载此脚本:

2). You said you checked for jQuery duplicates BUT you are loading this script:

<script type="text/javascript" id="cljs" src="https://taintmovie.cartloom.com/cart/cl?dr=1&ol=1"></script>

在此处链接,其中包括jQuery v1.4.2,因此它与已经加载的v1.7.2冲突.

LINK HERE, which includes jQuery v1.4.2 so it's conflicting with v1.7.2 already loaded.

这实际上是此错误的原因:

This is actually the reason of this error:

Error: TypeError: $(".fancybox").fancybox is not a function
Source File: http://www.taintmovie.com/storecartloom2/
Line: 40

...您可能想要编辑该文件并删除jQuery部分.

... you may want to edit that file and strip out the jQuery part.

3).您将fancybox绑定到选择器.fancybox上,如:

3). You are binding fancybox to the selector .fancybox like :

$(".fancybox").fancybox(); 

...但是您的html看起来像这样:

...however your html looks like:

<a class="fancybox.iframe" href="http://www.youtube.com/embed/bHEEdUQCNsM?autoplay=1"><img src="images/pantheonblack300.png"></a>

除了fancybox.iframe类外,您实际上还需要设置fancybox类:

you actually need to set the class fancybox besides the fancybox.iframe class like:

<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/bHEEdUQCNsM?autoplay=1"><img src="images/pantheonblack300.png"></a>

...否则它将无法正常工作.

... otherwise it won't work.

这篇关于TypeError:“未定义"不是函数(评估"$(“.fancybox").fancybox()')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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