最佳答案
进一步深入研究这个问题,是不是像之前建议的那样,fancybox.js 文件的打包版本已损坏(我将该文件与 fancybox 网站进行了比较,它们匹配。)
为了消除错误并使 fancybox 正常工作,您必须在网站中修复三件事:
1).关闭您的<head>
标签(目前没有 </head>
结束标签)
2).您说您检查了 jQuery 重复项,但您正在加载此脚本:
<script type="text/javascript" id="cljs" src="https://taintmovie.cartloom.com/cart/cl?dr=1&ol=1"></script>
LINK HERE ,其中包含 jQuery v1.4.2,因此它与已加载的 v1.7.2 冲突。
这实际上是这个错误的原因:
Error: TypeError: $(".fancybox").fancybox is not a function
Source File: http://www.taintmovie.com/storecartloom2/
Line: 40
...您可能想要编辑该文件并删除 jQuery 部分。
3).您正在将 fancybox 绑定(bind)到选择器 .fancybox
像:
$(".fancybox").fancybox();
...但是你的 html 看起来像:
<a class="fancybox.iframe" href="http://www.youtube.com/embed/bHEEdUQCNsM?autoplay=1"><img src="images/pantheonblack300.png"></a>
你实际上需要设置类 fancybox
除了 fancybox.iframe
类如:
<a class="fancybox fancybox.iframe" href="http://www.youtube.com/embed/bHEEdUQCNsM?autoplay=1"><img src="images/pantheonblack300.png"></a>
...否则它将无法工作。
关于jquery - 类型错误 : 'undefined' is not a function (evaluating '$(". fancybox").fancybox()'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11570952/