2015-05-15 51 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>