1.一个页面分享一个
讯享网
讯享网<div class="bshare-custom">
<a title="分享到空间" class="bshare-qzone"></a>
讯享网 <a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
<a title="分享到人人网" class="bshare-renren"></a>
讯享网 <a title="分享到腾讯微博" class="bshare-mb"></a>
<a title="分享到网易微博" class="bshare-neteasemb"></a>
讯享网 <a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis"></a>
<span class="BSHARE_COUNT bshare-share-count">0</span>
讯享网</div>
<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=2&lang=zh"></script>
讯享网
以下两个文件是按钮的不同样式文件,引用其一
讯享网<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
讯享网<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC2.js"></script>2.自定义页面中分享按钮的样式
讯享网<!-- 分享开始 -->
<div class="tleft pos_relative_share" > <span id="share_active_span"> <img class="share_img" src="public/images/student/index4/share.png" width="18px" height="17px" title="分享" /> 分享 </span> <script type="text/javascript" charset="utf-8"> bShare.addEntry({ title: "我正在乐学一百参加直播活动《{$sa_info['sa_title']}》,真有意思,已经有{$sa_info['sa_bm_num']}人报名了,你也来看看吧。", url: "http://www.lexue100.com", // summary: "分享的文本摘要,默认为页面Meta标签中description的内容或者用户高亮的内容", // pic: "http://www.lexue100.com/uploads/indexbannerimgs/banner_4d05f422c045756c36cb5a825f1ff27c.png" }); </script> <!-- 分享浮动窗开始 --> <div class="pos_absolute_share"> <table width="100%"> <tr height="30px"> <td width="30px" align="right"><img style="margin-top:3px;" src="public/images/student/active/im.png" /></td> <td class="share_desc" valign="middle" title="好友" οnclick="javascript:bShare.share(event,'im');return false;">好友</td> </tr> <tr height="30px"> <td width="30px" align="right"><img src="public/images/student/active/mb.png" /></td> <td class="share_desc" valign="middle" title="空间" οnclick="javascript:bShare.share(event,'qzone');return false;">空间</td> </tr> <tr height="30px"> <td width="30px" align="right"><img src="public/images/student/active/weixin.png" /></td> <td class="share_desc" valign="middle" title="微信" οnclick="javascript:bShare.share(event,'weixin');return false;">微信</td> </tr> </table> </div>
讯享网</div> <!-- 分享浮动窗结束 -->
讯享网3.一个页面多个分享按钮
第一种方法:
讯享网<!--{loop $play_list_data $k $v}--> <div id="share_outer_div_{$v[fm_id]}" style="display:none;"> <div class="bshare-custom icon-medium pos_fixed_share"> <a title="分享到空间" class="bshare-qzone" οnclick="javascript:bShare.share(event,'qzone');return false;"></a> <a title="分享到微信" class="bshare-weixin" οnclick="javascript:bShare.share(event,'weixin');return false;"></a> <a title="分享到新浪微博" class="bshare-sinaminiblog" οnclick="javascript:bShare.share(event,'sinaminiblog');return false;"></a> <!-- 在这里添加更多平台 --> </div> <script type="text/javascript" charset="utf-8"> var titlea = 'xx在小乐FM特意为你点了首歌《{$v[title]}》,请你来听'; bShare.entries = []; // 此处需要清空之前的addEntry中的值,重新赋值,不然只显示循环中第一个的内容 bShare.addEntry({ title: titlea, url: 'http://www.lexue100.com/mk.php?do=xlfm' }); </script> </div> <!--{/loop}-->
第一种方法:
讯享网<div class="col-xs-3 col-sm-3 col-md-3" style="padding-right:10px;height:20px;" οnmοuseοver="show_share('show', 'self', '{$v[at_id]}');" οnmοuseοut="show_share('hide', 'self','{$v[at_id]}');"> <div id="bdsharea_{$v[at_id]}" style="display:none;"> <!-- 百度分享插件 --> <!-- Baidu Button BEGIN --> <div id="bdshare" keyid="{$v[at_id]}" class="bdshare_t bds_tools get-codes-bdshare" data="{'text':'{$v[share]}', 'pic':'http://www.lexue100.com/{$_SC['article_pic_url']}{$v[at_pic]}'}"> <a class="bds_qzone"> </a> <a class="bds_tsina">新浪</a> </div> <script type="text/javascript" id="bdshare_js" data="type=tools" ></script> <script type="text/javascript" id="bdshell_js"></script> <script type="text/javascript">document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/); </script> <!-- Baidu Button END --> <!-- 百度分享插件 --> </div> </div>
讯享网第三种方法:
var headers = $(".postHeader"), posts = $(".postBody"); $.each(headers, function(i, h) { // 遍历所有文章标题元素 bShare.addEntry({ title:$(a).text(), // 获取文章标题 url:a.href, // 获取文章链接 summary:$(posts[i]).text(), // 从postBody中获取文章摘要 }); });
讯享网
4.修改按钮图片
讯享网如果您不喜欢我们提供的按钮,您可以使用自己的按钮图片。首先您必须提供一个可以从网上获取到的图片地址。
讯享网

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/70981.html