> For the complete documentation index, see [llms.txt](https://docs.maker.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maker.co/maker-pages/advanced-features/how-can-i-trigger-a-scroll-to-the-top-of-my-page-with-a-click-event-in.md).

# How can I trigger a scroll to the top of my page with a click event in Maker?

{% stepper %}
{% step %}

### Tip! Use this workflow if Maker content sits below content coming from your own CMS and you want a click event in Maker to take the user back to the top of your page.

{% endstep %}

{% step %}

### Click on the element you wish to use to create the click event. This can be a button, image, text, or textbox.

<figure><img src="/files/e5u8EzhMYMyYIRVAAgcZ" alt="How can I trigger a scroll to the top of my page with a click event in Maker? — step 2"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Click "Add link"

<figure><img src="/files/BqaWPArKKW5dNUkJcjqt" alt="How can I trigger a scroll to the top of my page with a click event in Maker? — step 3"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Click on Trigger Custom Javascript.

<figure><img src="/files/Mr2PcOaUhZc06c0dHv0i" alt="How can I trigger a scroll to the top of my page with a click event in Maker? — step 4"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Insert this Javascript: window\.scrollTo({

top: 0, left: 0, behavior: 'smooth' });

<figure><img src="/files/K4MRqmYqqF76nkM6jmHt" alt="How can I trigger a scroll to the top of my page with a click event in Maker? — step 5"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Click "Done"

<figure><img src="/files/Io79PaKQUxBVD2kGjn7l" alt="How can I trigger a scroll to the top of my page with a click event in Maker? — step 6"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Tip! top: 0 means to scroll to the top of the page. This can be adjusted to top: 200, for example, if we want to scroll 200px from the top

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maker.co/maker-pages/advanced-features/how-can-i-trigger-a-scroll-to-the-top-of-my-page-with-a-click-event-in.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
