QQ微博微信分享功能

 var _width = 600, _height = 600,
  _top = (screen.height-_height)/2,
  _left = (screen.width-_width)/2;  
/****
 * qq空间分享
 */
function shareToQzone(obj){
   var title=$("#"+obj.id).attr("data_title");
   var desc =$("#"+obj.id).attr("data_desc");
   var summary=$("#"+obj.id).attr("data_summary");
   var pic=$("#"+obj.id).attr("data_pic");
   var url=$("#"+obj.id).attr("data_url");
   $(".bd_weixin_popup").css('display','none');
   var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
   _shareUrl += 'url=' + encodeURIComponent(url||document.location);   //参数url设置分享的内容链接|默认当前页location
   _shareUrl += '&showcount=0';      //参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示
   _shareUrl += '&desc=' + encodeURIComponent(desc||'');    //参数desc设置分享的描述,可选参数
   _shareUrl += '&summary=' + encodeURIComponent(summary||'');    //参数summary设置分享摘要,可选参数
   _shareUrl += '&title=' + encodeURIComponent(title||'');    //参数title设置分享标题,可选参数
   _shareUrl += '&site=' + encodeURIComponent(basePath);   //参数site设置分享来源,可选参数
   _shareUrl += '&pics=' + encodeURIComponent(pic||'');   //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数
   window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');
}
/***
* 新浪微博分享
* @returns
*/
function shareToSinaWB(obj){
var title=$("#"+obj.id).attr("data_title");
    var pic=$("#"+obj.id).attr("data_pic");
    var url=$("#"+obj.id).attr("data_url");
$(".bd_weixin_popup").css('display','none');
var _shareUrl = 'http://v.t.sina.com.cn/share/share.php?&appkey=895033136';     //真实的appkey,必选参数 
_shareUrl += '&url='+ encodeURIComponent(url||document.location);     //参数url设置分享的内容链接|默认当前页location,可选参数
_shareUrl += '&title=' + encodeURIComponent(title);    //参数title设置分享的标题|默认当前页标题,可选参数
_shareUrl += '&source=' + encodeURIComponent(title);
_shareUrl += '&sourceUrl=' + encodeURIComponent(basePath);
_shareUrl += '&content=' + 'utf-8';   //参数content设置页面编码gb2312|utf-8,可选参数
_shareUrl += '&pic=' + encodeURIComponent(pic||'');  //参数pic设置图片链接|默认为空,可选参数
window.open(_shareUrl,'_blank','width='+_width+',height='+_height+',top='+_top+',left='+_left+',toolbar=no,menubar=no,scrollbars=no, resizable=1,location=no,status=0');
}
/****
 * 生成二维码
 */
function  shareToSinaWX(){
    $(".bd_weixin_popup").css('display','block');
    var userAgent = window.navigator.userAgent; //取得浏览器的userAgent字符串
    if (userAgent.indexOf("rv:11.0") >= 0 || userAgent.indexOf("MSIE") >= 0) {
    $('#bdshare_weixin_qrcode_dialog_qr').html("").qrcode({render:"images",width:220,height:220,correctLevel:0,text:location.href});
    }else{
    $('#bdshare_weixin_qrcode_dialog_qr').html("").qrcode({render:"canvas",width:220,height:220,correctLevel:0,text:location.href});
    }
}
/****
 * 生成二维码
 */
function  shareToSinaWX(url){
url = url||location.href;
$("#weixin_tc").css("top",200);
    $(".bd_weixin_popup").css('display','block');
    var userAgent = window.navigator.userAgent; //取得浏览器的userAgent字符串
    if (userAgent.indexOf("rv:11.0") >= 0 || userAgent.indexOf("MSIE") >= 0) {
    $('#bdshare_weixin_qrcode_dialog_qr').html("").qrcode({render:"images",width:220,height:220,correctLevel:0,text:url});
    }else{
    $('#bdshare_weixin_qrcode_dialog_qr').html("").qrcode({render:"canvas",width:220,height:220,correctLevel:0,text:url});
    }
}
 /***
  * 关闭二维码
  */
function weixinColse(){
   $(".bd_weixin_popup").css('display','none');

}


htm


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Tangyuewei

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值