Scroll back up when close state of multi-state box

Please check this page: (sorry, couldn’t add link, so I added spaces)
national music academy. com. au / our-national-music-academy-teachers

I don’t have coding experience and tried my luck. I was successful using multi-state boxes, but couldn’t figure out how to scroll back to the top when closing a state. I would like to close the window AND scroll to the top (anker?).

Eg, when you click ‘read more’ first teacher it opens fine. If you close it, it takes the user down to the next section, I would like it to go back up to the teacher.

I believe I have to add a snippet for scrolling back to an anker? I found this snippet from Wix.

State is closing perfectly with this code:

$w( “#button136” ).onClick(() => {
$w( ‘#statebox15’ ).changeState( “state12” );
} );

but how do I connect both ‘actions’ (close and scroll back up). I tried this, but it didn’t work to scroll up to the anker?

$w( “#button136” ).onClick(() => {
$w( ‘#statebox15’ ).changeState( “state12” );
$w( “#button136” ).scrollTo( “#anchor6” );
} );

Is it even better to rethink and use a different method? Not anker? Not multi-state box?

Thank you for your help!

Not sure how this link can help me?

The given link should show you, how to generate a “scroll-back” function.

Add an anchor somewhere, where you want to have the scroll-back-function to navigate to on your page. Add also a button and the following code to your page…


What does this code do?

It navigates/scrolls you to the ANCHOR-POSITION, when clicking onto an element, for example a BUTTON.

In the given link …
…you will find an appearing button at the bottom on the right-handed side of your screen, while scrolling down the page.

By a click onto this button, you will be navigatet back to the top of the page.