Setting anchor's location to a specific item in a dynamic page

Hi again.
I created a dynamic page collection and I am trying to set an anchor’s position relative to a certain container box in a dynamic page.

I used wix’s “anchor menu” item but since I’m on a dynamic page, as I add text to the page from the database, the position of my container boxes inside the page might change. I want my anchor’s positions to also change so they always bring to the top of such specific container boxes.

Can anyone help me achieve this? Thanks in advance.

1 Like

At the end I managed to make something similar to what I needed.
I created a “fake” anchor menu using a pinned container box containing various buttons.
I then used the .scrollTo() function on a “onClick” event to scroll the page to the container box I want users to reach when they click on a button.

export function testButton_click(event) {
    $w("#testBox1").scrollTo();
}

I’d still be interested to know if there’s a way to set an anchor’s position dynamically though… or if there’s a better way to reproduce what I just made.
Thanks in advance!