gpt4 book ai didi

facebook-like - 单击Facebook“赞”按钮后显示内容

转载 作者:行者123 更新时间:2023-12-04 03:13:29 26 4
gpt4 key购买 nike

我有一部分网页,我只希望人们在单击“Facebook点赞”按钮后才能访问。

如何隐藏该特定区域,然后仅在有人单击“赞”按钮后才显示该区域。

至于Facebook Like代码,它看起来像这样:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="www.oursite.com" show_faces="false" width="330" font="verdana"></fb:like>

<div id="hidden-area">Hidden Content</div>

最佳答案

使用'edge.create':

http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe

非常简单...甚至可以与jQuery结合使用。

<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $facebook->getAppId(); ?>',
session : <?php echo json_encode($session); ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});

// whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});

FB.Event.subscribe('edge.create', function(response) {
$.get('URLlink?uid=' + <?php echo $uid; ?>, function(data) {
$('#id').html(data);
});
});
};

(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>

关于facebook-like - 单击Facebook“赞”按钮后显示内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4414768/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com