首页 / 素材代码 / 新版百度百科边栏固定的百度分享

新版百度百科边栏固定的百度分享

访问百度百科时,看到侧边固定的百度分享,顺手巴拉下来,说不定哪天用上,分享一下。

bdshare-cmhello_com

在网页的 </body> 前面添加下面的代码(请修改 12 行的 uid 为自己的):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div id="bdshareside">
<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
<div class="shareLogo"></div>
<div class="shareIcon">
<a class="bds_qzone" title="分享到QQ空间" href="#"></a>
<a class="bds_tsina" title="分享到新浪微博" href="#"></a>
<a class="bds_tqq" title="分享到腾讯微博" href="#"></a>
</div>
<span class="bds_more"></span>
</div>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools&mini=1&uid=11321" ></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()/3600000)
</script>

然后在css文件添加下面的代码:

1
2
3
4
5
#bdshareside{width:38px;height:140px;border:1px solid #e6e6e6;background-color:#eee;position:fixed;top:270px;right:0;z-index:1024;*position:absolute}
#bdshareside .shareIcon a{padding:0;margin:0;width:25px;height:25px;margin-left:9px;margin-bottom:2px;_margin-left:4px}
#bdshareside .shareLogo{width:38px;height:32px;background:transparent url(https://www.cmhello.com/wp-content/uploads/2013/10/bdshare.png) -72px -24px no-repeat}
#bdshareside .bds_more{display:block;background:transparent url(https://www.cmhello.com/wp-content/uploads/2013/10/bdshare.png) -16px 5px no-repeat!important;width:38px;height:25px;padding:0}
#bdshareside .bds_more:hover{background:transparent url(https://www.cmhello.com/wp-content/uploads/2013/10/bdshare.png) -46px 5px no-repeat!important}

代码中用到的图片,请下载上传到自己的服务器(右键另存为),以防失效:

© 2009-2020 CMHELLO.COM · 基于 WordPress
Return top