微信放大

   注意图片都是相对地址 不要处理,,因为文章里面是相对地址。再组装绝对地址(注意头像)

    var host =window.location.host;


        $('#previewImage2 img').click(function(event) {
            var imgArray = [];
            var curImageSrc = $(this).attr('src');
            var oParent = $(this).parent();
            if (curImageSrc && !oParent.attr('href')) {
                $('.previewImage img').each(function(index, el) {
                    var itemSrc = $(this).attr('src');
                    itemSrc = 'http://'+host+itemSrc;
                
                    imgArray.push(itemSrc);
                });
                wx.previewImage({

                    current: 'http://'+host+curImageSrc,
                    urls: imgArray
                });
            }
        });

posted @ 2016-06-21 11:11  愤怒的小学生  阅读(155)  评论(0编辑  收藏  举报