bShare分享插件|自定义分享按钮|异步加载分享解决办法

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>bshare简单调用Js Api demo</title>
<link rel="Shortcut Icon" href="http://www.bshare.cn/favicon.ico" type="image/x-icon"/>
<link href="http://www.mtou091.com/ceshi/jstest/debug.css" rel="stylesheet" />
<head>
<style>
ul li { float:left; list-style-type:none; color: #999999; margin-right:0px; height:16px; line-height:16px; font-size:12px; margin-left:5px; }
.bshare img { border:none; }
</style>

<!--bshare 分享按钮主功能js -->
<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js"></script>
<script type="text/javascript" charset="utf-8" >
//预定义bshare分享按钮样式及配置参数
var bShareOpt = {style:-1,uuid:'',mdiv:-1};

function shareTo(event, shortName,obj) {
   //自定义设置内容,可动态获取当前页面内相应的参数进行传递
   var url= obj.url || "http://www.bshare.cn/";
   var str_title = obj.tit || "testTitle";
   var str_info = obj.info || "testSummary";
   var img = obj.img || "http://static.bshare.cn/images/bshare-logo-main.gif";
   //清除自定义分享内容的方法,在设置前清空,重新自定义内容
   bShare.entries = [];
   //添加自定义分享内容方法,不需要自定义的可以传递,bshare js会主动抓取页面相应值默认
   bShare.addEntry({
     title: str_title,
     url: url,
     summary: str_info,
       pic:img
  });
  //调用相应的分享方法,
  bShare.share(event, shortName);
}
</script>

<body>
<div class="wrap">
<div style="padding:200px 200px;margin:100px 100px;">
    <ul class="bshare">
        <li>分享到:</li>
        <li>
            <a title="分享到一键通"  onclick="shareTo(this,'bsharesync',{'url':'http://weather.com.cn','tit':'你是我的小','info':'这里好似摘要','img':'http://i.weather.com.cn/i/product/pic/l/sevp_nmc_weap_sob_efg_achn_lno_p9_20150113050002400.jpg'})" href="javascript:void(0);" ><img src="http://static.bshare.cn/frame/images/logos/s4/bsharesync.gif "/></a>
        </li>
        <li>
            <a title="分享到新浪微博"  onclick="shareTo(this,'sinaminiblog',{'url':'http://weather.com.cn','tit':'你是我的小','info':'这里好似摘要','img':'http://i.weather.com.cn/i/product/pic/l/sevp_nmc_weap_sob_efg_achn_lno_p9_20150113050002400.jpg'})" href="javascript:void(0);" ><img src="http://static.bshare.cn/frame/images/logos/s4/sinaminiblog.gif "/></a>
        </li>
        <li>
            <a title="分享到QQ空间"  onclick="shareTo(this,'qzone',{'url':'http://weather.com.cn','tit':'你是我的小','info':'这里好似摘要','img':'http://i.weather.com.cn/i/product/pic/l/sevp_nmc_weap_sob_efg_achn_lno_p9_20150113050002400.jpg'})" href="javascript:void(0);" ><img src="http://static.bshare.cn/frame/images/logos/s4/qzone.gif "/></a>
        </li>
        <li>
            <a title="分享到人人网"  onclick="shareTo(this,'renren',{'url':'http://weather.com.cn','tit':'你是我的小','info':'这里好似摘要','img':'http://i.weather.com.cn/i/product/pic/l/sevp_nmc_weap_sob_efg_achn_lno_p9_20150113050002400.jpg'})" href="javascript:void(0);" ><img src="http://static.bshare.cn/frame/images/logos/s4/renren.gif "/></a>
        </li>
        <li>
            <a title="分享到豆瓣"  onclick="shareTo(this,'douban',{'url':'http://weather.com.cn','tit':'你是我的小','info':'这里好似摘要','img':'http://i.weather.com.cn/i/product/pic/l/sevp_nmc_weap_sob_efg_achn_lno_p9_20150113050002400.jpg'})" href="javascript:void(0);" ><img src="http://static.bshare.cn/frame/images/logos/s4/douban.gif "/></a>
        </li>
    </ul>
</div>
</body>
</html>

 

转载于:https://www.cnblogs.com/liujinyu/p/4221465.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值