我有一个用来在colorbox中显示图像的代码:
<script type="text/javascript">
(function($){
$('a.gallery').colorbox({rel:'gal'});
})(jQuery);
</script>我正在研究的CMS是一团乱麻。它有prototype、jquery、jquery-ui等等。
在Firebug控制台中,我得到如下信息:此错误的数组长度中断无效
thisi = thisi + 1;
prototype.js线路387 (版本1.4.0),其为:
shift: function() {
var result = this[0];
for (var i = 0; i < this.length - 1; i++)
this[i] = this[i + 1];
this.length--;
return result;
}, 我得到的只是一个褪色的背景和颜色盒的角点加载(角点不会删除)。
jQuery.noConflict();也不起作用。
请帮帮我!
发布于 2014-12-09 00:39:32
好吧,我想通了。之所以会发生这种情况,是因为prototype.js扩展了原生Array.prototype.shift函数(以及其他函数),而该扩展包含了导致错误的bug。jQuery在第2109行使用shift )(https://github.com/jquery/jquery/blob/1.7.2/jquery.js#L2109),以及其他地方。这就是让我崩溃的地方。
我不希望这会对user1722113有所帮助,但希望它能帮助某些人。
我只能想到两种解决方案:
实现来替换它
https://stackoverflow.com/questions/12740559
复制相似问题