Resizing canvas for the app

試著忘記壹切 提交于 2019-12-12 05:26:37

问题


we have been trying to setup the height for a canvas app without luck.

this is the code we are using

window.fbAsyncInit = function()
{
// assume we are already logged in
FB.init({appId: '<?=$fb_app_id ?>', xfbml: true, oauth : true,cookie: true});
FB.Canvas.setAutoGrow();
}
function sizeChangeCallback() {
FB.Canvas.setSize({ width: 810, height: 950);
}

We tried both without the sizechangecallback

and our settings set to Fixed and Fixed 950


回答1:


After you setup the fixed height parameter in your application settings,
you can call FB.Canvas.setSize to change the page height.

If your page height changes dynamically, you can run FB.Canvas.setDoneLoading
to check if Canvas is loaded and run FB.Canvas.setAutoGrow.

window.fbAsyncInit = function() {
    // assume we are already logged in
    FB.init({ appId: '<?=$fb_app_id ?>', xfbml: true, oauth: true, cookie: true });

    FB.Canvas.setSize({ width: 810, height: 950 });

    FB.Canvas.setDoneLoading( function(response) {
        console.log(response.time_delta_ms);
        FB.Canvas.setAutoGrow();
    });
}

FB Documentation: https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setDoneLoading/



来源:https://stackoverflow.com/questions/11270906/resizing-canvas-for-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!