How do you animate FB.Canvas.scrollTo?

后端 未结 4 523
粉色の甜心
粉色の甜心 2020-12-13 10:50

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 the

4条回答
  •  春和景丽
    2020-12-13 11:39

    I just used Francis' technique and implemented a jQuery version

    $('html,body').animate(
      {scrollTop: $(".scroll_to_me").offset().top}, 
      {duration: 1000, step: function(top_offset){
        FB.Canvas.scrollTo(0, top_offset + 30);
      }
    });
    

    You need to replace the .scroll_to_me with the selector you want to scroll to. Also I added in the + 30 to the offset as the iframe doesn't start at the top of the page, you may want to tweak this.

提交回复
热议问题