Created
March 28, 2012 09:07
-
-
Save cgallagher/2224958 to your computer and use it in GitHub Desktop.
Animate scroll top within FB iFrame
This file contains hidden or 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
function scroll_to_top() { | |
FB.Canvas.getPageInfo(function (pageInfo) { | |
var iframe_scroll_y = pageInfo.scrollTop; | |
var target_div_y = $('#dr_dre').position().top; | |
if (iframe_scroll_y > target_div_y) { | |
var animOptions = { | |
step: function () { | |
FB.Canvas.scrollTo(0, this.y); | |
}, | |
duration: 200 | |
}; | |
$({ y: iframe_scroll_y }).animate({ y: target_div_y }, animOptions); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment