ckrack / fbootstrapp

HTML, CSS, and JS toolkit for facebook apps
http://ckrack.github.com/fbootstrapp/
Apache License 2.0
1.61k stars 173 forks source link

FB.Canvas.setSize #3

Open ibes opened 12 years ago

ibes commented 12 years ago

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

ckrack commented 12 years ago

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

tobsn commented 12 years ago

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

ckrack commented 12 years ago

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

262media commented 12 years ago

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