2012-07-09 49 views
0

与Facebook的Javascript-SDK工作(从服务器asyncronously加载)给出了奇效:如何防止Facebook的SDK(JavaScript)的右移动注销按钮左(“PluginResize”)

后通过SDK成功登录到FB,FB-Logout-Button从右向左移动并返回。

登录/注销按钮被声明为:

<fb:login-button size="large" autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button> 

停止在Firebug的结果脚本称为M6XESwM2V2D.js和JavaScript的文件中,有下面的代码行:

__d("PluginResize",["Log","UnverifiedXD","bind","copyProperties","curry"],function(a,b,c,d,e,f){var g=b('Log'),h=b('UnverifiedXD'),i=b('bind'),j=b('copyProperties'),k=b('curry');function l(o){o=o||document.body;return o.offsetWidth+o.offsetLeft;}function m(o){o=o||document.body;return o.offsetHeight+o.offsetTop;}function n(o,p,event){this.calcWidth=o||l;this.calcHeight=p||m;this.width=undefined;this.height=undefined;this.event=event||'resize';}j(n.prototype,{resize:function(){var o=this.calcWidth(),p=this.calcHeight();if(o!==this.width||p!==this.height){g.debug('Resizing Plugin: (%s, %s, %s)',o,p,this.event);this.width=o;this.height=p;h.send({type:this.event,width:o,height:p});}return this;},auto:function(o){setInterval(i(this,this.resize),o||250);return this;}});n.auto=function(o,p,event){return new n(k(l,o),k(m,o),event).resize().auto(p);};e.exports=n;}); 

在javascript-debugger中停止代码时,按钮移动将停止(如预期的那样),然后继续执行代码。在上面打印的JavaScript代码中有一个对setInterval-Method的调用。所以,这可以解释这种行为。但为什么他们这样做?

我该如何阻止这种效应?

回答

1

顺便说一句 - 添加样式= “的位置是:固定;”到登录按钮帮助我:

<fb:login-button autologoutlink="true" style="position: fixed;"></fb:login-button> 

干杯, KT。

+0

谢谢,它的作品! – itinance 2012-07-12 17:08:33

1

我实际上在我的网站上遇到同样的问题。这似乎是一个与Facebook的错误。我提出它作为一个错误的位置:

https://developers.facebook.com/bugs/302726826490772

+0

此错误已被facebook标记为fixready。 – Neil 2012-07-13 09:21:12

+0

它今天是固定的。 – 2012-07-18 11:08:35

+0

@JamieKitson我也是! – Neil 2012-07-18 16:18:00