Reputation: 3853
This is a really annoying problem I keep having with facebook page tabs.
I use FB.Canvas.setAutoGrow(true);
to automatically resize the iframe to the content, which works great, but only one way. Works nice when the page grows from jQuery animation and ajax objects.
But FB.Canvas.setAutoGrow(true);
only seems to work when it grows, not if I navigate to a page within my page iframe that is shorter than previous page.
I get a big white block appear at the bottom, which is the height of my previous page.
How can I shrink the facebook iframe when a page gets smaller? Any help would be great thanks.
This is how i'm currently using the auto grow...
window.fbAsyncInit = function() {
FB.init({
appId : '<?php global $app_id; echo $app_id; ?>', // App ID
channelUrl : '<?php global $channel_url; echo $channel_url; ?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Canvas.setAutoGrow(true);
};
Upvotes: 0
Views: 1079
Reputation: 11
this would help
window.fbAsyncInit = function() {
FB.init({"appId": "624452304314106", "status": true, "cookie": true, "xfbml": true});
//FB.Canvas.setAutoGrow();
//FB.Canvas.scrollTo(0,0);
FB.Canvas.setSize({height:600});
setTimeout("FB.Canvas.setAutoGrow()",500);
};
reference: http://www.twistermc.com/36764/shrink-facebook-tabs/
Upvotes: 1
Reputation: 8568
Use FB.Canvas.scrollTo to scroll to top.
FB.Canvas.scrollTo(0,0);
https://developers.facebook.com/docs/reference/javascript/FB.Canvas.scrollTo/
Upvotes: 0