Facebook Share button and that little annoying behaviour with zero counts

The new Facebook Share button is very cool and offers a new insightful information about your posts: the share count.
Alas, when no one has yet shared your post, the count balloon disappears in thin air. This give you layout headaches, because the widget doesn’t fill a fixed area in the page.
jQuery to the rescue! I wrote this simple code to fix the problem and show a neat “0” count beside the post. Thought I’d share for someone out there in need :)

jQuery(document).ready(function(){
  jQuery("span.fb_share_no_count").each(function(){
    jQuery(this).removeClass("fb_share_no_count");
    jQuery(".fb_share_count_inner", this).html("0");
  });
});

Count greater that 0

Hi, I'm having the same problem even if the count is greater than 0. Seems like other's have the same problem: http://bugs.developers.facebook.com/show_bug.cgi?id=8032 Do you know of a way to get that count w/o making a restserver call to the fb api? Thanks so much for this!

Code Placement

So...where does this code go? Somewhere within the button script?

Thanks a lot!

Thanks a lot!

0 count on Like button?

Great fix for share. Can you please figure out the same fix for the Facebook "Like" button?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.