4

I have some simple piece of codes which scroll the page to top with animation by clicking on every link containing the class of "top" and some other codes which I use them to scrol down to a specific div id.

But When I remove vertical scrolbar in facebook app pages by adding FB.Canvas.setAutoGrow(); and FB.Canvas.setSize(); that piece of code does not work any more in the facebook app page and I can not scroll to top and down. I searched and it seems we should use FB.Canvas.scrollTo from Facebook JS SDK instead.

By the way as much as I try to do so it seems I can't do that. If anybody can guide me in this regard I'll be so thankful.

Arash
  • 514
  • 3
  • 15

2 Answers2

1

In the setting, it should be set to fluid. also just using setAutoGrow() should be enough.

Notice that FB.Canvas.scrollTo and FB.Canvas.setSize only work when you have the screen height as fixed so you can manage the canvas size and locate the user where you want. In fact FB.Canvas.scrollTo doesn't work in Fluid mode! btw, if your planning to use the fixed height, it's useful to manage to screen height change in the following way:

$(window).resize(function() {

    scrHeight = $(window).height();

    // now you can use FB.Canvas.scrollTo and FB.Canvas.setSize 
    // here to satisfy your purposes  
});
  • 1
    Thanks Saber, nice advice. But do you know how to use FB.Canvas.scrollTo ?? – Arash Nov 21 '12 at 12:32
  • Oh, and where should I put this function? I got a little confused man – Arash Nov 21 '12 at 13:03
  • this is a jquery function which runs everytime the screen height is changed, also you can use scrHeight = $(window).height(); to find out the current screen height. Of course you need to use it inside your js code – Saber Kordestanchi Nov 21 '12 at 13:04
  • I mean for example when I click a link how should I use FB.Canvas.scrollTo to scroll to top or down ( specially With jQuery animations ) to a specific place somewhere? – Arash Nov 21 '12 at 13:09
  • for that part, you better check this one. I hope I've been clear enough :) http://facebook.stackoverflow.com/questions/7193425/how-do-you-animate-fb-canvas-scrollto – Saber Kordestanchi Nov 21 '12 at 13:13
  • I'll try it, Thank you Saber, +1 bounce – Arash Nov 21 '12 at 13:18
0

In your FB app settings you have:

Canvas Width:Fluid
Fixed (760px)
Canvas Height: Fluid
Fixed at X px

check if you selected fluid height

banzsh
  • 540
  • 1
  • 4
  • 18