scrollTo( )
Scrolls the page to the top of the element using an animation.
Description
The scrollTo()
function returns a Promise that is resolved when the
animated scroll is complete and the element is in view.
To scroll to a specific location on the page, see the wix-window-frontend
scrollTo()
function.
Tip: Use the
wix-window-frontend
scrollTo()
function to scroll directly to an element, and also disable the animation. To get the coordinates for scrolling, display the Wix Editor Toolbar. In the Editor, move the cursor to the top-left pixel where you want the page to scroll to. The X and Y axis Position values show the coordinates.
Notes:
- You can't call the
scrollTo()
function on an element inside a repeater.- To use
scrollTo()
with a header element, the Header Scroll Setting must be set to Scrolls with site. To scroll to the header with other settings, use thewix-window-frontend
scrollTo()
function.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When the scroll is complete.
Returns an empty object.
Status/Error Codes
Was this helpful?
1$w("#myElement").scrollTo();
1$w("#myElement").scrollTo()2 .then( ( ) => {3 console.log("Done with scroll");4} );