> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.unicornplatform.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Scroll to top button (back-to-top)

To add a button, you need to make the following changes in the ' **General settings** ':

1. In the ' **Global <head> HTML code** ' section, insert the following code:'

```
<script>
    function handleScroll() {
      var scrollToTopBtn = document.getElementById("scrollToTopBtn");
      if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
        scrollToTopBtn.style.display = "block";
      } else {
        scrollToTopBtn.style.display = "none";
      }
    }
    function scrollToTop() {
      document.body.scrollTop = 0;
      document.documentElement.scrollTop = 0;
    }
    window.onscroll = function() {
      handleScroll();
    };
</script>
```

![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_1cwmoej.png =500x500) 

2. In the ' **Global <body> HTML code** ' section, add the following code:

```
<button id="scrollToTopBtn" onclick="scrollToTop()">🔺</button>
<style>
    #scrollToTopBtn {
      display: none;
      z-index: 999;
      position: fixed;
      bottom: 20px;
      right: 48.5%;
      background-color: #007bff;
      color: #fff;
      border: none;
      border-radius: 50px;
      padding: 17px 15px;
      cursor: pointer;
    }
</style>
```

![](https://storage.crisp.chat/users/helpdesk/website/-/7/e/7/8/7e782a40c0560c00/image_g8kd6d.png =500x500)

3. Save the changes and open your page. The button will now appear as you scroll.

![](https://storage.crisp.chat/users/upload/session/a42089083b18a800/chromewyk4emzt8q_f9aomz.png)