Switching Between Two Anchors Points by Clicking on a Button

SITUATION:
I have 1 Button + 2 Anchor Points

TASK:
When the user clicks the button he’s directed to the Anchor Point 1 and when he clicks again was directed to the Anchor Point 2.

QUESTION:
Could anyone share some code examples that makes possible to accomplish this task? My knowledge of codes is very basic.:sweat_smile:

Thanks in advance!

Hi,
You can create a function that uses scrollTo method and toggle between 2 anchor.
It should look something like this:

let scrollTo = 'top';
function button_onclick(event, $w) {
  if (scrollTo === 'top') {
    $w('#topAnchor').scrollTo();
    scrollTo = 'bottom';
  } else {
    $w('#bottomAnchor').scrollTo();
    scrollTo = 'top';
  }
}

Good luck!
Roi.