修复layer.photos所有图片都加载失败时不停弹窗的bug

pull/13/head
zhe-he 2015-09-17 13:41:15 +08:00
parent 9671b5c64c
commit b59a6aa250
1 changed files with 4 additions and 3 deletions

View File

@ -134,10 +134,11 @@ layer.photos = function(options, loop, key){
}; };
//下一张 //下一张
dict.imgnext = function(key){ dict.imgnext = function(key,errorMsg){
dict.imgIndex++; dict.imgIndex++;
if(dict.imgIndex > data.length){ if(dict.imgIndex > data.length){
dict.imgIndex = 1; dict.imgIndex = 1;
if (errorMsg) {return};
} }
dict.tabimg(key) dict.tabimg(key)
}; };
@ -193,7 +194,7 @@ layer.photos = function(options, loop, key){
callback(img); callback(img);
}; };
img.onerror = function(e){ img.onerror = function(e){
img.onload = null; img.onerror = null;
error(e); error(e);
}; };
img.src = url; img.src = url;
@ -244,7 +245,7 @@ layer.photos = function(options, loop, key){
}, function(){ }, function(){
layer.close(dict.loadi); layer.close(dict.loadi);
layer.msg('当前图片地址异常', {time: 2000}, function(){ layer.msg('当前图片地址异常', {time: 2000}, function(){
data.length > 1 && dict.imgnext(true); data.length > 1 && dict.imgnext(true,true);
}); });
}); });
}; };