2015-05-15 42 views
0

这是我如何生成我的分享按钮:如何给Facebook分享按钮添加一个计数器(通过FB.ui生成)?

<a href="#" class="share-btn">Share to Facebook</a> 

    <script type="text/javascript"> 
    function fb_share() { 
    var fbMsg = $('.lesson_lt_share_popup').text().trim() 
    FB.ui({ 
     method: 'feed', 
     name: "Chinese Learn Online | Progressive Mandarin Course", 
     link: "http://www.chineselearnonline.com/level-test/", 
     picture: "http://www.chineselearnonline.com/wp-content/themes/clo/assets/img/images/clo-fb-white.png", 
     description: fbMsg 
    }, function(response) { 
     // do nothing 
    }); 
    } 

    // add click event to link using jQuery 
    $(document).ready(function(){ 
    $('.share-btn').on('click', fb_share); 
    }); 

但是我算找到生成的official docs反什么。

这怎么办?

+0

你可以尝试跟踪元素上的点击吗? –

回答

1

添加属性data-layout="button_count"

<a href="#" class="share-btn" data-layout="button_count">Share to Facebook</a>