Home  >  Article  >  Backend Development  >  百度分享旋钮在项目中的使用

百度分享旋钮在项目中的使用

WBOY
WBOYOriginal
2016-06-13 12:18:27875browse

百度分享按钮在项目中的使用

在项目中用到了百度分享按钮,主要实现代码如下:

<script><br />window._bd_share_config={<br /> "common":{<br /> "bdText" : '分享有好礼相赠!', <br /> "bdDesc" : '', <br /> "bdUrl" : 'http://www.baidu.com',#此处写分享地址<br /> "bdSign": 'off'<br /> },<br /> "image":{<br /> "viewList":["qzone","tsina","tqq","renren","weixin"],<br /> "viewText":"分享到:",<br /> "viewSize":"16"<br /> }<br />};<br /> <br />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)];<br /></script>

百度分享按钮的全部参数及用法:


<script><br /> window._bd_share_config = {<br /> common : {//此处是通用设置<br /> bdText : '自定义分享内容', <br /> bdDesc : '自定义分享摘要', <br /> bdUrl : '自定义分享url地址', <br /> bdPic : '自定义分享图片'<br /> },<br /> share : [{#此处是放置分享按钮的设置<br /> "bdSize" : 16<br /> }],<br /> slide : [{#此处放置悬浮窗分享设置 <br /> bdImg : 0,<br /> bdPos : "right",<br /> bdTop : 100<br /> }],<br /> image : [{#此处放置图片分享设置<br /> viewType : 'list',<br /> viewPos : 'top',<br /> viewColor : 'black',<br /> viewSize : '16',<br /> viewList : ['qzone','tsina','huaban','tqq','renren']<br /> }],<br /> selectShare : [{#此处放置划词分享设置<br /> "bdselectMiniList" : ['qzone','tqq','kaixin001','bdxc','tqf']<br /> }]<br /> }<br />#js加载部分,这部分的代码是固定的,不能随意更改。<br /> with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];<br /></script>


具体详解见:http://share.baidu.com/code/advance 里面有详细教程

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn