FBJS 函数 getAbsoluteLeft 的 Javascript 替代方案
我正在将一个项目从以前的 Facebook Api (FBJS) 迁移到新的 API。有一个函数的名称为:
getAbsoluteLeft()
我不知道为什么使用它。谁能提供它的 javascript 替代品吗?
I am migrating a project from previous Facebook Api (FBJS) to the new API. There is a function with the name:
getAbsoluteLeft()
I have no idea why this is used. Can anyone provide its javascript alternate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据文档页面 getAbsoluteLeft 上的描述
:
获取绝对顶部:
如果您在 iFrame 中使用 jQuery,则可以使用 offset 函数来获取元素的左侧和顶部。
According to what is described on the documentation page
getAbsoluteLeft:
getAbsoluteTop:
If you are using jQuery in iFrame, you can use the offset function to get left and top of the element.
好吧,我也没有找到代码本身。
这是我在我的一个项目中使用的类似代码,
它返回具有
left
和top
属性的对象。因此,对于getAbsoluteLeft
只需返回getCoords(obj).left
。如果你有的话,像另一个答案一样使用 jQuery 会更好。
Ok, I haven't found the code itself too.
Here's the similar code, I used in ony of my project
It returns object with
left
andtop
properties. So forgetAbsoluteLeft
just returngetCoords(obj).left
.Using jQuery like in another answer is even better, if you have it.