微信分享到朋友圈的内容和图片的定制

var dataForWeixin={
   appId:"",
   MsgImg:"http://img1.faxinxila.net/images/share_msg.png",
   TLImg:"http://img1.faxinxila.net/images/share.png",
   url:"http://faxinxi.la/vote/1",
   title:"input title here",
   desc:"input description here",
   fakeid:"",
   callback:function(){}
};
(function(){
   var onBridgeReady=function(){
   //发送给朋友
   WeixinJSBridge.on('menu:share:appmessage', function(argv){
      WeixinJSBridge.invoke('sendAppMessage',{
         "appid":dataForWeixin.appId,
         "img_url":dataForWeixin.MsgImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){(dataForWeixin.callback)();});
   });
   //发送到朋友圈
   WeixinJSBridge.on('menu:share:timeline', function(argv){
      (dataForWeixin.callback)();
      WeixinJSBridge.invoke('shareTimeline',{
         "img_url":dataForWeixin.TLImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){});
   });
   //分享到微博
   WeixinJSBridge.on('menu:share:weibo', function(argv){
      WeixinJSBridge.invoke('shareWeibo',{
         "content":dataForWeixin.title,
         "url":dataForWeixin.url
      }, function(res){(dataForWeixin.callback)();});
   });
   //分享到facebook
   WeixinJSBridge.on('menu:share:facebook', function(argv){
      (dataForWeixin.callback)();
      WeixinJSBridge.invoke('shareFB',{
         "img_url":dataForWeixin.TLImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){});
   });
};
if(document.addEventListener){
   document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
}else if(document.attachEvent){
   document.attachEvent('WeixinJSBridgeReady'   , onBridgeReady);
   document.attachEvent('onWeixinJSBridgeReady' , onBridgeReady);
}
})();
收藏 5分享浏览 8235
芋头7423
5年前
跟帖
yostyang
4年前

赞了此话题!

沙发
芋头
4年前

赞了此话题!

板凳

赞了此话题!

地板
极乐网
2年前

赞了此话题!

4 楼
说几句
广告位 点击查看投放指南

我的收藏