目前支持自定義分享圖片的平臺(tái)有新浪微博、騰訊微博、搜狐微博、網(wǎng)易微博、qq空間、人人網(wǎng)、豆瓣。如果此值為空,將會(huì)根據(jù)分享平臺(tái)原有的抓圖機(jī)制來獲取您網(wǎng)站的圖片。您可以通過如下配置設(shè)置您想要分享出去的圖片:
1、通過全局配置進(jìn)行修改:
<!-- Baidu Button BEGIN --> <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare"> <a class="bds_qzone">QQ空間</a> <a class="bds_tsina">新浪微博</a> <a class="bds_tqq">騰訊微博</a> <a class="bds_renren">人人網(wǎng)</a> <span class="bds_more">更多</span> </div> <script type="text/javascript" id="bdshare_js" data="type=tools&mini=1" ></script> <script type="text/javascript" id="bdshell_js"></script> <script type="text/javascript"> //在這里定義bds_config var bds_config = {'bdPic':'這里填寫您要分享的圖片地址,比如 http://yourname.domain.com/images/test.jpg'}; document.getElementById('bdshell_js').src = "http://share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000); </script> <!-- Baidu Button END -->
2、通過增加按鈕html標(biāo)簽的data屬性進(jìn)行修改:
<!-- Baidu Button BEGIN --> <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare" data="{'pic':'這里寫入您想要自定義的分享圖片 A'}"> <a class="bds_qzone">QQ </a> <a class="bds_tsina">新浪</a> <a class="bds_tqq">騰訊</a> <a class="bds_renren">人人</a> <span class="bds_more">更多</span> </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()/3600000); </script> <!-- Baidu Button END --> <!-- Baidu Button BEGIN --> <div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare" data="{'pic':'這里寫入您想要自定義的分享圖片 B'}"> <span class="bds_more">更多</span> <a class="bds_tsina">新浪</a> <a class="bds_tqq">騰訊</a> <a class="bds_renren">人人</a> <a class="bds_qzone">QQ </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()/3600000); </script> <!-- Baidu Button END -->
更多建議: