我用大量的图片时加载到DOM如若跌破
html += '<img src="'+image.preview+'" title="View larger image" alt="'+image.item_title+'" height="'+image.display_height+'" width="'+image.display_width+'">';
的数据来自一个Ajax调用,并在for循环中,每个图像在页面上哪里来交换图像。我有两个图像裁判的情况下,一个被打破image.preview
和image.preview2
(我用两成image.preview是本地的,但在错误的情况下再image.preview2是原始图像)
如果image.preview
坏我想切换到image.preview2
我在尝试以下但不知道放置在哪里?
$('img').on('error', function() { this.src = image.preview2; });
我的html +=
受审,中,后但没有中间似乎工作 - 任何想法?
阅读评论直接你上面。 – 2013-02-22 10:00:00