我有一个像Facebook页面一样的弹出框。按下“喜欢”按钮后,我需要删除这个iframe弹出窗口,所以我尝试使用FB.Event.subscribe('edge.create', ...
但是这个事件没有触发,我错过了什么?
function popup() {
$(document).ready(function () {
window.fbAsyncInit = function () {
FB.init({
appId: 'my app ID',
authResponse: false,
channelUrl: "my channelUrl",
cookie: true,
oauth: true,
status: true,
xbfml: true
});
FB.Event.subscribe('edge.create',
function (response) {
alert('You liked the URL: ' + response);
});
FB.Event.subscribe('edge.remove',
function (response) {
alert('You liked the URL: ' + response);
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});
function makingdifferent_ppopup() {
var mdwh = jQuery(window).height();
var mdpph = jQuery("#makingdifferentpopup").height();
var mdfromTop = jQuery(window).scrollTop() + 50;
jQuery("#makingdifferentpopup").css({
"top": mdfromTop
});
}
jQuery(window).fadeIn(makingdifferent_ppopup)
.resize(makingdifferent_ppopup)
var mdleftm = 500;
jQuery("#makingdifferentpopup").animate({
opacity: "1",
left: "0",
left: mdleftm
}, 0).show();
jQuery("#mdclose").click(function () {
jQuery("#makingdifferentpopup").animate({
opacity: "0",
left: "-5000000"
}, 1000).show();
});
}