socialforge/public/javascripts/wechat/directives/img_preview.js

22 lines
669 B
JavaScript

/**
* Created by ttang on 2016/9/20.
*/
app.directive('imgPreview',["$timeout",'wx',function(timer,wx){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
var srcList = [];
$.each($(".post-all-content img"),function(i,item){
if(item.src){
srcList.push(item.src);
$(item).click(function(e){
wx.previewImage({current:this.src,urls:srcList});
});
}
});
})
}
}
}]);