在 Mac 和 Windows 上隐藏 Facebook 点赞按钮的计数
我想使用 Facebook Like 按钮,但没有计数。我尝试将其容器的宽度设置为 47px,没有溢出。这适用于 Windows 上的浏览器,但在 Mac OS X 上,按钮的宽度似乎扩展到 49px,因此部分内容被切断。
有谁知道如何使用带有button_count样式的Like按钮,但没有计数并且在Windows和Mac上没有以不同的方式显示?
这是我用于 Facebook 按钮的代码:
<script type="text/javascript">
//<![CDATA[
//Facebook like button
window.fbAsyncInit = function() {
FB.init({xfbml: true});
};
//]]>
</script>
<div id="fb-root"></div>
<fb:like href="{{ page_url }}" send="false" layout="button_count" width="49" height="21" show_faces="false"></fb:like>
<script type="text/javascript">
(function() {
var e = document.createElement('script');
e.async = true;
e.src = (document.location.protocol == 'file:' ? 'http:' : document.location.protocol) + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
I'd like to use the Facebook like button but without the count. I've tried just setting the width of it's container to 47px, with no overflow. This works on browsers on Windows, but on Mac OS X the width of the button seems to expand to 49px, so part of it is cut off.
Does anyone know of a way to use the Like button, with button_count style, but without the count AND without it being displayed differently on Windows and Mac?
Here is the code I'm using for the Facebook button:
<script type="text/javascript">
//<![CDATA[
//Facebook like button
window.fbAsyncInit = function() {
FB.init({xfbml: true});
};
//]]>
</script>
<div id="fb-root"></div>
<fb:like href="{{ page_url }}" send="false" layout="button_count" width="49" height="21" show_faces="false"></fb:like>
<script type="text/javascript">
(function() {
var e = document.createElement('script');
e.async = true;
e.src = (document.location.protocol == 'file:' ? 'http:' : document.location.protocol) + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能在CSS中设置按钮的宽度,以便所有浏览器都同时显示它吗?也许尝试使用“!important”标签,以便它在 fb 样式表中持续存在。这应该允许相同的“黑客”隐藏显示。
我认为没有办法默认隐藏它。如果按钮的宽度在按下后发生变化,您可能还需要调整样式。
Could you set the width of the button in CSS so that all browsers show it at the same with? Maybe try to use the "!important" tag so that it persist over the fb style sheet. That should allow the same "hack" to hide the display.
I don't think there is a way to hide it by default. You may also have to tweak the style if the width of the button changes after it is pressed.