<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
//微信自带的图片预览
$(document).on(‘click‘, ‘.previewImage img‘,function(event) {
var imgArray = [];
var curImageSrc = $(this).attr(‘src‘);
//alert(1);
var oParent = $(this).parent();
if (curImageSrc && !oParent.attr(‘href‘)) {
$(‘.previewImage img‘).each(function(index, el) {
var itemSrc = $(this).attr(‘src‘);
imgArray.push("http://192.168.31.129/qianfan/"+itemSrc);//如果在微信上测试,点击预览后出现一直在加载无法显示的情况,建议把图片的路径设置成全路径,如:http://blog.zongdaosoft.com/uploadFiles/uploadImgs/17/1.jpg
});
wx.previewImage({
current: curImageSrc,
urls: imgArray
});
}
});