How to prevent the facebook-SDK (Javascript) is mo

2019-09-15 01:52发布

Working with facebook Javascript-SDK (loaded from its servers asyncronously) gives a strange effect:

after successfully login to FB via SDK the FB-Logout-Button is moving pixelwise from right to left and back.

The login/logout-button is declared as:

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

stopping the script in Firebug results in a javascript-file called M6XESwM2V2D.js and there in the following code lines:

__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;});

When halting the code in javascript-debugger, the button movement stops (as expected), and proceeding the code moves it on. In the above printed javascript-Code there is a call to the setInterval-Method. So, this could explain the behaviour. But why do they do something like this?

How can i stop this effect?

2条回答
Lonely孤独者°
2楼-- · 2019-09-15 02:09

Btw - adding style="position:fixed;" to the login-button helped me:

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

Cheers, KT.

查看更多
Evening l夕情丶
3楼-- · 2019-09-15 02:14

I'm actually getting the same issue on my website. It appears to be a bug with facebook. I've raised it as a bug at:

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

查看更多
登录 后发表回答