Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you animate FB.Canvas.scrollTo?

I've created an app that is a set size (around 2,000 px tall) and have a menu that calls FB.Canvas.scrollTo in order to help the user navigate the long page.

Is there any way to add a smooth scrolling effect? Facebook does not offer any solution on its developer blog.

like image 917
Carson Avatar asked Aug 25 '11 15:08

Carson


1 Answers

Using @Jonny's method, you can do this a little more simply with

function scrollTo(y){
    FB.Canvas.getPageInfo(function(pageInfo){
            $({y: pageInfo.scrollTop}).animate(
                {y: y},
                {duration: 1000, step: function(offset){
                    FB.Canvas.scrollTo(0, offset);
                }
            });
    });
}
like image 53
Dave Avatar answered Oct 13 '22 18:10

Dave