百度分享自定义分享案例

1、参考文档:http://share.baidu.com/code/advance#config-share

2、自定义案例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
<style type="text/css" media="screen">
/* .bdsharebuttonbox a{display:inline-block;height:100px;background:url(http://42.121.106.37//images/logo.png);width:100px;float:left;}
 .bds_qzone{background:#999;}
.bds_tsina{background:#333;}*/
</style>
</head>
<body>


<div id="share">
    <div class="bdsharebuttonbox" data-tag="share_1">
        <a class="bds_mshare" data-cmd="mshare">mshare</a>
        <a class="bds_qzone" data-cmd="qzone">qzone</a>
        <a class="bds_tsina" data-cmd="tsina">tsina</a>
        <a class="bds_baidu" data-cmd="baidu">baidu</a>
        <a class="bds_renren" data-cmd="renren">renren</a>
        <a class="bds_tqq" data-cmd="tqq">tqq</a>
    </div>
</div>

<script>
    window._bd_share_config = {
        "common": {
            "bdSnsKey": {},
            "bdMini": "2",
            "bdMiniList": false,
            "bdText": '自定义分享内容', 
            "bdDesc": '自定义分享摘要', 
            "bdUrl": '自定义分享url地址',   
            "bdPic": '自定义分享图片',
            "bdStyle": "1",
            "bdSize": "16"
        },
        "share": {
            "bdSize": 16,
            "bdCustomStyle":"./css/demo.css"
        }
    }

    //以下为js加载部分
    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)];
</script>
</body>
</html>

你可能感兴趣的:(百度分享自定义分享案例)