Scroll to different positions on a page.
Introduction
Last updated: 26 Nov 2025
In this example, we demonstrate how to scroll to a specific position on the page across multiple scenarios:
This example illustrates practical ways to implement scrolling behavior on a site.
We added the following to our site:
The code in this file handles button clicks that trigger the different scrolling behaviors on the page. In this file, we:
getBoundingRect() to retrieve the viewport height of the visitor’s browser window.onClick() event handlers for 5 buttons.scrollTo() and scrollBy() methods, and the Text element’s scrollTo() method to the different page positions.Join the Wix Studio community on Discord, where experienced developers and fellow creators come together to share tips, troubleshoot issues, and collaborate.
Building a coded solution on your own can be challenging. Let an experienced Wix developer build it for you, so you can keep working on your site or business. Visit the Wix Marketplace to find a trusted developer.