首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何防止facebook-SDK (Javascript)将注销按钮从右向左移动("PluginResize")

如何防止facebook-SDK (Javascript)将注销按钮从右向左移动("PluginResize")
EN

Stack Overflow用户
提问于 2012-07-10 04:22:57
回答 2查看 654关注 0票数 0

使用facebook Javascript-SDK (从服务器异步加载)会产生一种奇怪的效果:

通过SDK成功登录FB后,FB-Logout-Button将按像素从右向左和向后移动。

login/logout-button声明为:

代码语言:javascript
复制
<fb:login-button size="large" autologoutlink="true" perms="email,user_birthday,status_update,publish_stream"></fb:login-button>

在Firebug中停止该脚本会生成一个名为M6XESwM2V2D.js的javascript文件,并出现在以下代码行中:

代码语言: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-Code中,有一个对setInterval-Method的调用。因此,这可以解释这种行为。但是他们为什么要这样做呢?

我怎样才能停止这个效果?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-07-12 21:00:29

顺便说一下-在登录按钮中添加style="position:fixed;“帮助了我:

代码语言:javascript
复制
<fb:login-button autologoutlink="true" style="position: fixed;"></fb:login-button>

干杯,KT。

票数 1
EN

Stack Overflow用户

发布于 2012-07-10 17:12:16

实际上,我的网站上也出现了同样的问题。这似乎是facebook的一个bug。我在以下位置将其作为bug提出:

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11402525

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档