Created
May 10, 2012 17:24
-
-
Save patbenatar/2654573 to your computer and use it in GitHub Desktop.
Resizing the frame and body of Facebook apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ -> | |
setFbSize() | |
$('body').bind('resizeframe', setFbSize) | |
# If this page has fbcomments on it, we need to set height at an interval | |
# so we resize when new comments/interactions with that widget happen | |
if $('.fb-comments').length | |
setInterval(setFbSize, 100) | |
$(window).load -> | |
setFbSize() | |
setFbSize = -> | |
h = $('#site_container').outerHeight(true) | |
# set size of fb canvas | |
FB.Canvas.setSize | |
width: 520 | |
height: h | |
# set size of body | |
$('body').height(h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html, body { | |
width: 520px; | |
} | |
body { | |
overflow: hidden; | |
} | |
#site_container { | |
width: 520px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<div id="site_container"> | |
<%= yield %> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment