不能在Magento中使用Fancybox2。错误:“未捕获的TypeError ...没有方法......”

时间:2012-06-14 11:28:51

标签: javascript jquery magento fancybox

我已经包含了像这里指示的fancybox2文件 http://fancyapps.com/fancybox/#instructions 使用我的扩展xml和 <action method="addJs"> 对于javascript文件和 <action method="addItem"> 为css。

我包含的js和css文件的顺序:

<link rel="stylesheet" type="text/css" href="magento/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="magento/js/n123/fancybox2/source/jquery.fancybox.css" />
<link rel="stylesheet" type="text/css" href="magento/skin/frontend/default/default/css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" href="magento/skin/frontend/base/default/css/widgets.css" media="all" />
<link rel="stylesheet" type="text/css" href="magento/skin/frontend/default/default/css/print.css" media="print" />
<script type="text/javascript" src="magento/js/prototype/prototype.js"></script>
<script type="text/javascript" src="magento/js/lib/ccard.js"></script>
<script type="text/javascript" src="magento/js/prototype/validation.js"></script>
<script type="text/javascript" src="magento/js/scriptaculous/builder.js"></script>
<script type="text/javascript" src="magento/js/scriptaculous/effects.js"></script>
<script type="text/javascript" src="magento/js/scriptaculous/dragdrop.js"></script>
<script type="text/javascript" src="magento/js/scriptaculous/controls.js"></script>
<script type="text/javascript" src="magento/js/scriptaculous/slider.js"></script>
<script type="text/javascript" src="magento/js/varien/js.js"></script>
<script type="text/javascript" src="magento/js/varien/form.js"></script>
<script type="text/javascript" src="magento/js/varien/menu.js"></script>
<script type="text/javascript" src="magento/js/mage/translate.js"></script>
<script type="text/javascript" src="magento/js/mage/cookies.js"></script>
<script type="text/javascript" src="magento/js/n123/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="magento/js/n123/jquery/jquery.no.conflict.js"></script>
<script type="text/javascript" src="magento/js/varien/product.js"></script>
<script type="text/javascript" src="magento/js/varien/configurable.js"></script>
<script type="text/javascript" src="magento/js/calendar/calendar.js"></script>
<script type="text/javascript" src="magento/js/calendar/calendar-setup.js"></script>
<script type="text/javascript" src="magento/js/n123/fancybox2/source/jquery.fancybox.pack.js"></script>

然后在我的模板(phtml)中添加了以下代码:

<a id="single_1" href="http://farm8.staticflickr.com/7100/6917703112_d18e3e1b95_b.jpg" title="Assunção - Santo Tirso...a New Dimension... (Alex Matos)">
<img src="http://farm8.staticflickr.com/7100/6917703112_d18e3e1b95_m.jpg" alt="" />
</a>
<script type="text/javascript">
  jQuery(document).ready(function() {
    jQuery("#single_1").fancybox({
          helpers: {
              title : {
                  type : 'float'
              }
          }
      });
</script>

在Chrome中出现此错误:

http://www.imagebanana.com/view/6oxxttnx/s02.png

       Uncaught TypeError: Object function wrap(wrapper) {
             var __method = this;
             return function() 
                       {
                          var a = update([__method.bind(this)],  arguments) ;
                          return wrapper.apply(this, a);
                       }
       } has no method 'unbind'

欢迎每一位帮助!

1 个答案:

答案 0 :(得分:1)

我找到了一个golution:在我的情况下,打包的“fancybox.pack.js”不起作用我上面发布了错误,但“fancybox.js”(“解压缩”/正常版本)的工作方式一个魅力!感谢您的支持和关注。