Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Like-Button - hide count?

Tags:

facebook

In the setup dialog for the Like-Button, there are only two options for layout:

  • Alternative 1
  • Alternative 2

Unfortunately, the numbers for the website of my employer is nowhere near 22'000, so the powers that be have decided that we should not show the number of "likes" until said number is a little more in our favour. As far as I know, I don't have access to the layout of the button through Javascript or CSS (it's in an iframe served by facebook). Are there any other ways to hide the count?

like image 506
Benjamin Wohlwend Avatar asked Jun 01 '10 13:06

Benjamin Wohlwend


4 Answers

If you do overflow:hidden then keep in mind that it will also hide the comment box that comes up in XFBML version... after user likes it. So best if you do this...

/* make the like button smaller */
.fb_edge_widget_with_comment iframe
{
    width:47px !important;
}

/* but make the span that holds the comment box larger */
span.fb_edge_comment_widget.fb_iframe_widget iframe
{
    width:401px !important;
}
like image 74
farooq Avatar answered Oct 24 '22 09:10

farooq


The Like button coded to show "Recommend" is 84px wide and the "Like" button is 44px, will save some time for you CSS guys like me who need to hide how unpopular my page currently is! I put this code on top of my homepage, so initially I don't want it to advertise how few Likes I have.

like image 24
The Surrican Avatar answered Oct 24 '22 09:10

The Surrican


Accepted answer is good, but be careful with multilingual pages. The text differ in length:

English: Like

Dutch: Vind ik leuk

German: Gefällt mir

Just a heads up.

like image 42
Bondt Avatar answered Oct 24 '22 09:10

Bondt


Just encompass the iframe in a div set the width to the width of button, set overflow to hidden i.e.

  <div style="width:52px;overflow:hidden;">
      <fb:like layout="button_count"></fb:like>

      <div id="fb-root"></div>
          <script>
              window.fbAsyncInit = function() {
                  FB.init({
                    appId: 'YOUR_APP_ID',
                    status: true,
                    cookie: true,
                    xfbml: true
                  });
              };
              (function() {
                  var e = document.createElement('script');
                  e.type = 'text/javascript';
                  e.src = document.location.protocol +
                  '//connect.facebook.net/en_US/all.js';
                  e.async = true;
                  document.getElementById('fb-root').appendChild(e);
              }());
          </script>
      </div>
like image 10
Silly Rabbit Avatar answered Oct 24 '22 07:10

Silly Rabbit