Scroll to top of page from within Facebook app

When within a facebook app you sometimes want to scroll to the top of the page but outside of the iframe which contains your app. To do that you use the following code in javascript:

FB.Canvas.scrollTo(0,0);

 This will only work when your canvas height is set to “Settable”. By default 800px. You can make in settable in the app Dashboard

The scrollTo function uses two parameters. First is x position en second is y position to scroll to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s