Tuc*_*uck 5 height facebook facebook-timeline
我正在为具有"时间轴"布局的Facebook页面开发应用程序,我希望应用程序的高度随内容缩放,但应用程序的高度固定为800px.
当前的应用程序设置显示高度设置为"流体",但我也尝试将高度固定为随机值,并且目睹没有变化.
如何让我的应用程序的高度扩展到它的内容?感谢您的回复.
更新:所以附加到我的身体标签工作.
<body onload="FB.Canvas.setSize({width: 810, height: 910})">
<div id="fb-root"></div>
<script>
(function () {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js#xfbml=1&appId=YOURAPPID;
e.async = true;
document.getElementById('fb-root').appendChild(e);
} ());
</script>
Run Code Online (Sandbox Code Playgroud)
但我不知道为什么它有效,所以我想我会把我的问题改为'上面的代码是做什么的?' 所以我真的可以理解下次要采取的步骤.我现在把它作为答案来解决这个问题.
这是设置的正确方法,我只需要盯着它看一段时间并且阅读文档的方式太多次了.将以下内容放在fb-root div下面就像一个冠军.
window.fbAsyncInit = function () {
FB.init({
appId: 'YOURAPPID', // App ID
channelUrl: '/channel.html', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
FB.Canvas.setAutoGrow(); //Resizes the iframe to fit content
};
// Load the SDK Asynchronously
(function (d) {
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
} (document));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4084 次 |
| 最近记录: |