Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.Canvas.scrollTo

SDK Reference › JavaScript SDK › FB.Canvas.scrollTo

Note: this method is only enabled when Canvas Height is set to "Settable (Default: 800px)" in the App Dashboard.

Tells Facebook to scroll to a specific location of your canvas page. This should be used in conjunction with FB.Canvas.setSize and FB.Canvas.setAutoResize.

Examples

To scroll to the top of the page you could use the following code:

FB.Canvas.scrollTo(0,0);

Parameters

NameTypeDescription
paramsObject
Property Type Description Argument
x Integer Horizontal scroll position. Required
y Integer Vertical scroll position. Required
Updated about 2 weeks ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy