不能操纵Facebook的按钮宽度 [英] Can't manipulate width of Facebook Like Button

查看:273
本文介绍了不能操纵Facebook的按钮宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个边栏200px宽,我喜欢的Facebook按钮我放在里面是运行在DIV的边界之外。是否有任何解决方法来获取Like框文本来识别200px标记,并在需要时回流到新行?

I have a sidebar 200px wide and the Facebook Like button I have placed inside it is running outside the boundaries of the DIV. Are there any workarounds to get the Like box text to recognise the 200px mark and reflow onto new lines when needed?

我使用此代码: http://jsfiddle.net/tKkpm/2/

<div id="fb-root"></div>
<script>(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&appId=437745402932329";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://www.facebook.com/google" data-send="false"
 width="200" data-show-faces="false"></div>


推荐答案

Facebook Like按钮文档说明最小宽度必须为225像素。

The Facebook Like Button documentation states that the minimum width has to be 225 pixels.

有时可能小于该值的原因是因为您可以使用 iframe

The reason it can sometimes be less than that, is because you can use an iframe. Although smaller widths aren't fully supported, it does seem to work!

<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fgoogle&amp;send=false&amp;layout=standard&amp;width=200&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:35px;" allowTransparency="true"></iframe>

请注意,您必须在两个不同的位置设置宽度!

Please note that you will have to set the width in two different places!

这篇关于不能操纵Facebook的按钮宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆