Change the width of a like button

独自空忆成欢 提交于 2020-01-16 08:55:28

问题


I'm trying to change the width of the Like button on my site, but for some reason it's not working. I've tried the HTML5, iFrame and XFBML versions, but they all get rendered to the same size. Any ideas on what I'm doing wrong? Code is below.

<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
   <head>
   </head>
   <body>
   <div class="fb-like" data-href="http://www.facebook.com" data-send="false" data-layout="button_count" data-width="2000" data-show-faces="false"></div>
   <fb:like href="http://www.facebook.com" send="false" layout="button_count" width="3000" show_faces="false"></fb:like>
   <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com&amp;send=false&amp;layout=button_count&amp;width=1600&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:1600px; height:100px;" allowTransparency="true"></iframe>
   <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'MY_ID', // App ID
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          oauth      : true, // enable OAuth 2.0
          xfbml      : true  // parse XFBML
        });

        // Additional initialization code here
      };


(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
    </script>
   </body>
</html>

回答1:


Minimum width size is 55px.

3000 is probably a bit too much. Try using the tool at http://developers.facebook.com/docs/reference/plugins/like/ to make a realistic sized button.




回答2:


I advise you please use this plugin for html5

<div class="fb-like" data-href="your_link_goes_here" data-send="true" data-width="450" data-show-faces="true"></div>

Thanks...



来源:https://stackoverflow.com/questions/8429092/change-the-width-of-a-like-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!