Facebook as the minimum button width

I have an xfbml version of the Facebook button on my website, and I noticed that when the page loads, the button loads on the right side and then centers itself (where it should be). I played with the width, trying different sizes and finally setting it to 0 or automatically fixes the problem completely. The button loads in the center and does not move.

My question is simply that he is allowed to have "width: auto", as the Facebook developer page says that the minimum is "225".

I apologize in advance, but I'm starting to start.

<fb:like href="http://mywebsite.com" send="false" layout="button_count" width="auto" show_faces="false" font="verdana"></fb:like> 
+4
source share
1 answer

You did it, there is no way to make a Like button with the width auto .

As a workaround, you can measure the width of the space that the button should take and dynamically indicate it in the button code, but in this case you will need to use FB.parse () to convert the <fb:like> code to a working button.

Example:.

 $(document).ready(function(){ btnWidth = parseInt($(".buttonContainer").width(), 10) - 5; $(".buttonContainer").append('<fb:like href="http://mywebsite.com" send="false" layout="button_count" width="' + btnWidth + '" show_faces="false" font="verdana"></fb:like>'); FB.parse($(".buttonContainer").get()); }); 
+1
source

All Articles