Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
FB: Canvas - Scroll To Top
// Function for returning the user to any 'y' position in a Facebook app/tab. Uses jQuery animate, otherwise gracefully falls-back without it.
// Source[1]:
// Source[2]:
var scrollY = function (y) {
if (window.jQuery) {
FB.Canvas.getPageInfo (function (pageInfo) {
$({ y: pageInfo.scrollTop })
y: y
duration: 1000,
step: function (offset) {
FB.Canvas.scrollTo(0, offset);
} else {
FB.Canvas.scrollTo(0, y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.