所以,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/