fbootstrapp icon indicating copy to clipboard operation
fbootstrapp copied to clipboard

FB.Canvas.setSize

Open ibes opened this issue 13 years ago • 4 comments

Hi,

any plans to include a ready to include (link) .js-file wo easily get this to work: https://developers.facebook.com/docs/reference/javascript/FB.Canvas.setSize/

You need to load the JS SDK and then it is simple. Would be nice to have one maintained file to just script-link in an get a auto sized canvas/tab.

Here like I use it with asynchronous load of the JS SDK:

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

(function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }());

ibes avatar Jan 10 '12 22:01 ibes

yep, it's planned to do that! https://github.com/ckrack/fbootstrapp/blob/master/TODO.md

ckrack avatar Jan 10 '12 23:01 ckrack

there should be a default example set of functions to get this going - is there a dev branch to see changes? i wouldnt mind pushing some examples ;)

tobsn avatar Jan 12 '12 18:01 tobsn

Yeah i agree. The dev branch is here: https://github.com/ckrack/fbootstrapp/tree/development

It's currently on the same status as the master branch.

If you want to push that'd be great. The examples are the examples/fb-* files. These are supposed to be the starting point.

I'd prefer to have the javascript code seperate in js/application.js

ckrack avatar Jan 12 '12 18:01 ckrack

If using FB.Canvas.setAutoGrow(); with a page with more than the regular 800px the modals fired from fbootstrap get misplaced (sometimes not visible in the screen area but placed in the center of the iframe). any thoughts about how to solve this?

Probably not the best coding but I've implemented this to solve my own question:

function scrollTo(y){ FB.Canvas.getPageInfo(function(pageInfo){ $({y: pageInfo.scrollTop}).animate( {y: y}, {duration: 1000, step: function(offset){ FB.Canvas.scrollTo(0, offset); } }); }); }

//usage: $('.modal').bind('shown', function () { var isto = $(this).offset();

var quanto = isto.top;

scrollTo(quanto);

})

//but i'm open to other sugestions //P.S.:sorry for my bad english

262media avatar Mar 17 '12 17:03 262media