javascript - <div id ="fb-root"和 JS 的最佳位置在哪里?

标签 javascript facebook asynchronous facebook-javascript-sdk

所以,div 和对 fb js 的调用:Fb 说将其放在 (body) 标记后面。任何使用它的 wp 插件都会将其放在页脚中(wp_footer(),因为,没有 wp_just_after_body())。我曾经遇到过一种情况,我需要的 Facebook 功能只有当这些东西位于 body 标签之后时才起作用。我对 js 的了解不够,无法知道其中的区别以及正文或页脚是否是最佳位置。

最佳答案

就在您要加载的每个页面上的开始正文标记之后。

来自 facebook SDK 文档的更多信息:

The fb-root element must not be hidden using display: none or visibility: hidden, or some parts of the SDK will not work properly in Internet Explorer.

The SDK inserts elements into fb-root which expect to be positioned relative to the body or relative to an element close to the top of the page. It is best if the fb-root element is not inside of an element with position: absolute or position: relative. If you must place the fb-root element inside of a positioned element, then you should also give it a position close to the top of the body or some parts of the SDK may not work properly.

关于javascript - <div id ="fb-root"和 JS 的最佳位置在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11417664/

相关文章:

javascript - 如何在 JavaScript 中设置函数执行顺序以使用回调函数?

javascript - 如何在 Google Chrome 开发者工具中获取格式化的控制台消息?

facebook - Facebook 应用程序的站点 URL

Java:我该如何关闭包裹在 SLF4J 外观中的异步附加程序?

asynchronous - Mono 下的 F# 任务并行性不会 "appear"并行执行

javascript - qooxdoo中如何设置窗口高度最大化?

javascript - 导航器振动破解 ios 浏览器上的代码

javascript - 以文本形式获取脚本内的内容

objective-c - Facebook Like 按钮未在 Cocoa WebView 中启动新窗口

asynchronous - Future.error 和 dart Future 中的 throw 有什么区别?