在网页中添加分享按钮,可以免费使用百度分享代码,貌似现在在官网找不到入口获取代码,下边是之前在网上找到的分享代码,仍然可以使用。
1 2 3 4 5 6 7 8 9 10 11
| <div class="bdsharebuttonbox"> <a href="#" class="bds_more" data-cmd="more"></a> <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a> <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a> <a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a> <a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a> <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a> </div> <script> window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"24"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]; </script>
|
但在网站添加了百度分享代码之后,会发现网页上的图片鼠标滑过,就会出现百度分享代码图标,当网页中有大量图片的时候会严重影响美观。
解决办法就是删除百度分享代码中的”image”:{“viewList”:[“qzone”,”tsina”,”tqq”,”renren”,”weixin”],”viewText”:”分享到:”,”viewSize”:”24”},这一段代码即可。