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

22 lines
669 B
JavaScript
Raw Normal View History

2016-09-20 14:42:36 +08:00
/**
* 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){
2016-09-20 15:14:48 +08:00
wx.previewImage({current:this.src,urls:srcList});
2016-09-20 14:42:36 +08:00
});
}
});
})
}
}
}]);