Scroll to another block on button click

The buttons in the Canvas Page editor have only the possibility to go to another page in the same or a new tab.

How can I have the buttons scroll down to another block on the same page when clicked?

Hello @eduard welcome to the forum!

Could you please share a screenshot about what you need? It may help in order to provide better guidance. :smiley:

Thanks @cmarchan ! Please find attached a screenshot!

Hello @eduard,

It’s possible to scroll to a specific Y position on the page using this JS:


Scrolling to a specific element is harder since we don’t expose the ability to add IDs to elements. You can write some Javascript that will get the target element by its text and scroll there. Using XPaths may work for this, or you can try the approach suggested in this stackoverflow thread.

1 Like

Hello @chris ,

Wouldn’t scrolling from 0 to 2000 be different on different screen sizes?
And wouldn’t some browsers block the javascript for security purposes?

On mobile it will load to a different part of the page, yes. The code to scroll to the exact object you want to scroll to will be different on each page, but that link I sent above is a good place to start if you’d like to try writing the javascript for that action.

Running javascript should work just fine - all Bubble actions and even loading a static page on Bubble rely on javascript, so if the user has javascript disabled in their browser then they won’t be able to use a Bubble app at all.

1 Like

Thanks @chris ! I will use that to scroll!

1 Like