Home > Backend Development > PHP Tutorial > javascript - How to use Baidu sharing in the list page?

javascript - How to use Baidu sharing in the list page?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-09-11 11:34:13
Original
1134 people have browsed it

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? javascript - How to use Baidu sharing in the list page?

Reply content:

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? javascript - How to use Baidu sharing in the list page?

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>
Copy after login

Just add the corresponding custom link, title and other information to the bdsharebuttonbox layer

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template