Colorbox未显示 - 错误$ .data(this,colorbox)未定义

时间:2012-10-27 13:51:01

标签: colorbox opencart

我正在尝试在类别页面上加载弹出图像,但是在单击图像时出现此错误。

Timestamp: 10/27/2012 7:15:10 PM
Error: TypeError: $.data(this, colorbox) is undefined
Source File: http://woodanta.6point9.in/catalog/view/javascript/jquery/colorbox/jquery.colorbox.js
Line: 246

颜色框正在产品页面上工作,但不在类别上。任何人都可以帮我这个吗?

类别:http://woodanta.6point9.in/index.php?route=product/category&path=60

产品:http://woodanta.6point9.in/index.php?route=product/product&product_id=50

1 个答案:

答案 0 :(得分:3)

Colorbox使用jQuery.data()将其设置对象添加到它所分配的元素中。在您指定颜色框的时间和单击链接的时间之间,将从元素中删除此设置对象。这通常发生在复制/替换文档中的元素(使用$ .html())时,它不复制使用$ .data存储的数据,而不是克隆它们或附加/添加现有元素。

我建议禁用与colorbox无关的脚本,以确定导致问题的脚本。此外,您可以在将colorbox分配给元素之前等待其他脚本执行,从而避免此问题。