Php 如何调整FB.ui流发布对话框的位置
我正在facebook中使用FB.ui方法显示流发布框,如下所示:Php 如何调整FB.ui流发布对话框的位置,php,javascript,facebook,Php,Javascript,Facebook,我正在facebook中使用FB.ui方法显示流发布框,如下所示: function showfeed() { var publish = { method: 'stream.publish', attachment: { name: 'XYZ', caption: 'caption here', description: ('description'), href: 'url', media:
function showfeed()
{
var publish = {
method: 'stream.publish',
attachment: {
name: 'XYZ',
caption: 'caption here',
description: ('description'),
href: 'url',
media: [{
type: 'image',
href: 'url',
src: 'xyz.gif'
}]
},
action_links: [{ text: 'XYZ', href: 'url' }]
};
FB.ui(publish,null);
}
这很好,但我的页面高度很长,所以当我单击按钮显示此对话框时,它显示在页面的中心而不是顶部,所以即使对话框显示在中心,它也不会显示给我,因为我在顶部。顶部是否有“定位”对话框,以便任何人都能看到。将下面的代码添加到
。[从其他论坛获得)希望这会有所帮助
div.fb_dialog_advanced+div.fb_dialog_advanced {
top:50px !important;
}
div.fb\u dialog\u advanced+div.fb\u dialog\u advanced{top:50px!important;}
不再工作。请参阅此:
:
但是我已经用jQuery解决了这个问题。它有点粗糙,但它可以工作:
function move_to_top( value )
{
$(".fb_dialog").each(function(index) {
if($(this).css("top")!='-10000px') {
$(this).css("top", value + 'px' );
}
});
setTimeout( ('move_to_top("'+value+'");'), 1250);
}
function send_request()
{
FB.Canvas.scrollTo(0,0);
FB.ui({method: 'apprequests', message: 'Press accept to see this request.', data: 'tracking information for the user'},
function(response) {
if(response!=null)
{
alert('You are boss')
}
});
$(".fbProfileBrowserResult").ready( function(){
t = setTimeout ( ('move_to_top("'+50+'")'), 1250 );
});
}
谢谢你的代码。对我来说非常好。我注意到你忘了在move_to_top函数中使用value参数。我认为$(this).css(“top”,“50px”);需要是$(this).css(“top”,“value+'px”);还有一个小的输入错误:$(this)而不是j(this)