时间轴页面应用程序高度卡在800px

时间轴页面应用程序高度卡在800px

本文介绍了时间轴页面应用程序高度卡在800px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有时间轴布局的Facebook页面的应用程序,我希望应用程序的高度可以扩展内容,但应用程序的高度固定为800像素。



当前的应用设置显示高度设置为流畅,但我也尝试将高度固定为随机值,目睹没有变化。



如何让我的应用程序的高度扩展到内容?感谢任何答复。



更新:
所以将其附加到我的body标签。

 < 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>

但是我没有理由为什么它工作,所以我想我会把我的问题改为'上面的代码做了吗?所以我实际上可以明白下一步要采取什么步骤。我现在将此作为一个答案来解决问题。

解决方案

这是设置事物的正确方法我只是盯着它一会儿,并且阅读文档的方式太多次了。将fb-root div放在fb-root div下面就像一个冠军。

  window.fbAsyncInit = function(){
FB.init({
appId:'YOURAPPID',// App ID
channelUrl:'/channel.html',// Channel File
status:true,// check login status
cookie:true,//启用Cookie以允许服务器访问会话
xfbml:true //解析XFBML
});
FB.Canvas.setAutoGrow(); //调整iframe以适应内容
};
//异步加载SDK
(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));


I'm developing an app for a Facebook page with the 'timeline' layout, and I want the height of the app to scale with the content, but the height of the app is fixed at 800px.

The current app settings show that the height is set to 'fluid,' but I have also tried fixing the height to random values and witnessed no change.

How to I get the height of my app to scale to it's content? Thanks for any responses.

Update:So appending this to my body tag worked.

<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>

But I have zero idea why it worked, so I guess I'll change my question to 'what does the above code do?' so I can actually understand what steps to take next time. I'll put this as an answer for now to close off the question though.

解决方案

This is the proper way to set things up, I just had to stare at it for a while and read the documentation way too many times. Putting the following below the fb-root div worked like a champ.

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

这篇关于时间轴页面应用程序高度卡在800px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 19:17