Home > Article > Backend Development > javascript - How to use Baidu sharing in the list page?
On a list page, I need Baidu Sharing interface to share each piece of information individually. However, the custom interface I use Baidu Sharing is always for sharing web pages. How to do this?
On a list page, I need Baidu Sharing interface to share each piece of information individually. However, the custom interface I use Baidu Sharing is always for sharing web pages. How to do this?
I have done this before, but there is no method. I will switch to a third-party one later, and it is also free. This plugin is very powerful.
Please refer to the following for details
http://blog.bshare.cn/
<code>var shareurl = ""; var sharedesc=""; var sharepic=""; var sharetitle=""; $(".bdsharebuttonbox a").mouseover(function () { shareurl = $(this).parents(".bdsharebuttonbox").attr("data-url"); sharedesc=$(this).parents(".bdsharebuttonbox").attr("data-desc"); sharepic=$(this).parents(".bdsharebuttonbox").attr("data-pic"); sharetitle=$(this).parents(".bdsharebuttonbox").attr("data-title"); }); function SetShare(cmd, config) { if (shareurl) { config.bdUrl = shareurl; } if(sharedesc){ config.bdDesc = sharedesc; } if(sharepic){ config.bdPic = sharepic; } if(sharetitle){ config.bdText = sharetitle; } return config; } window._bd_share_config = {"common": {onBeforeClick:SetShare,"bdSnsKey":{},"bdMini":"2","bdMiniList":false,"bdStyle":"0","bdSize":"24"}, "share": {}} 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)];</code>
Just add the corresponding custom link, title and other information to the bdsharebuttonbox layer