隐藏 Facebook Like 按钮上的计数器
我有一个带有 Facebook Like 按钮的简单 html 页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
channelURL: 'http://myurl.com', // channel.html file
oauth: true // enable OAuth 2.0
});
};
(function(d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));
</script>
<fb:like href="http://myurl.com" layout="button_count" show_faces="false" width="450" height="35" action="like" colorscheme="light" font="trebuchet ms" allowTransparency="true"></fb:like>
</body>
</html>
如何隐藏按钮旁边的计数器?
多谢!
I have simple html page with FaceBook Like button:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
channelURL: 'http://myurl.com', // channel.html file
oauth: true // enable OAuth 2.0
});
};
(function(d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));
</script>
<fb:like href="http://myurl.com" layout="button_count" show_faces="false" width="450" height="35" action="like" colorscheme="light" font="trebuchet ms" allowTransparency="true"></fb:like>
</body>
</html>
How can I hide counter next to button?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Facebook 提供的 iframe 代码,网址为 http://developers.facebook.com/docs/reference /plugins/like 然后将其包装在一个 div 中,高度和宽度以及溢出隐藏。
Use the iframe code provided by Facebook at http://developers.facebook.com/docs/reference/plugins/like then wrap it in a div with height and width and overflow hidden.
我现在已经测试了几个版本。
a) 你在不同的浏览器上遇到很多问题,你必须检查每个浏览器版本
b) 有一个名为“ClearClick”的 noscript 插件 - 它将警告/阻止用户单击此类隐藏的 FB 按钮。对此没有解决方案。那么有 1 种解决方案,隐藏空间必须位于屏幕之外,因此 ClearClick 无法重新呈现它并且不会警告用户。但我相信你不希望你的“赞”按钮出现在你的页面顶部。
I've tested several versions now.
a) You get many problems on different browsers, you have to check every browser version
b) There is a noscript addon named "ClearClick" - it will warn/prevent users from clicking on such a hidden FB Button. There is no solution against that. Well there is 1 solution, the hidden space must be OUTSIDe the screen so ClearClick can not reender it and does not warn the user. But you do not want your like button on the top of your page I believe.
从 John 的链接中选择标准的 facebook 按钮就可以了! ;)
Choose standart facebook like button from John's link it will be ok! ;)