没带图片类型的图片不让点击放大看!

This commit is contained in:
yuanke 2016-05-13 16:09:26 +08:00
parent a67ee38ac9
commit be97675aed
1 changed files with 7 additions and 4 deletions

View File

@ -1013,15 +1013,18 @@ function showNormalImage(id) {
var image=$(description_images[i]); var image=$(description_images[i]);
var _path = getRootPath(); var _path = getRootPath();
//如果图片是视频图片,不处理。 //如果图片是视频图片,不处理。
if($(image).hasClass("mediaIco")){ if($(image).hasClass("mediaIco")){
var _src = _path+"/"+$(image).attr('src'); var _src = _path+"/"+$(image).attr('src');
$(image).attr('src',_src); $(image).attr('src',_src);
return; return;
} }
var tmpsrc = image.attr('src');
var element=$("<a></a>").attr("href",image.attr('src')); if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) {
image.wrap(element); var element = $("<a></a>").attr("href", image.attr('src'));
$(image).parent().colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); image.wrap(element);
$(image).parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false});
}
} }
//$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框 //$('#'+id+' a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); //有图片才将链接变为弹出框
} }