开发者

Facebook App - Javascript Set Height of Canvas?

I am trying to set the height so I don't have a scrollbar in my facebook app, seen HERE

I have used jQuery to create the canvas plugin using the GRAPH API and have tried adding the following codes to edit the height but none work. Anyone have any ideas?

In my scripts.js I try adding the following to the bottom:

FB.Canvas.setAutoResize();  //doesn't work

Also tried the following:

window.fbAsyncInit = function() {
FB.Canvas.开发者_如何转开发setSize({ height: 2500 });
}; //doesn't work either


window.fbAsyncInit = function() {
   FB.Canvas.setSize({height: 1050});
}

// Do things that will sometimes call sizeChangeCallback()
function sizeChangeCallback() {
   FB.Canvas.setSize();
}


Just for clarification for other users who happen on this content:

  • Add the

    <script src="http://connect.facebook.net/en_US/all.js"></script> and <script> FB.init({ appId : 'here_your_API_id', status : true, cookie : true, xfbml : true }); </script>

    code before your </head> tag.

  • Add the <div id="fb-root"></div>

<script src="http://connect.facebook.net/en_US/all.js"></script>

`<script>window.fbAsyncInit = function() {FB.Canvas.setSize({height: 1050});}`
`function sizeChangeCallback() {FB.Canvas.setSize();}</script>`

portion right before the </body> tag.

  • If all else fails, try the following:

    <style>body {width:500px; height:1050px;overflow:hidden;margin:0; padding:0; border:0;}</style>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜