PIT Designs Logo

How to Add Back To Top Button in Oxygen Builder

I'm the owner and founder of PIT Designs. I love creating digital presence and creative digital solutions for our clients.


Posted 2 years ago on July 16th, 2019. Last modified on June 7th, 2020

Related To:


Up to 35% OFF AliDropship Plugin

Back to Top button is a very useful feature for any website. It provides an easy solution to go back to the top of the page, in one click. Without having to scroll all the way back up. Especially on blog posts, with long articles. You can find some ready-made back to top buttons here. However, in this tutorial we will create our own, and customize it.

Oxygen builder doesn't have the option by default. So to add a back to top button in Oxygen builder, follow these easy steps:

Step One:

In the main template (the one that's active for all pages)

Add a new Code Block at the very bottom (under the Footer section). And in the HTML part of the code block, enter this code:

<button onclick="topFunction()" id="back-top" title="Go to top">⮝</button>

Step Two:

In the same Code Block, add this code to the JavaScript part:

&nbsp;

window.onscroll = function() {scrollFunction()};

function scrollFunction() {
  if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
    document.getElementById("back-top").style.display = "block";
  } else {
    document.getElementById("back-top").style.display = "none";
  }
}


function topFunction() {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
}

Step Three:

In the main CSS style sheet, add the following code:

#back-top {
display: none;
position: fixed;
bottom: 2.5em;
right: 0.7em;
border: white;
background-color: #40C351;
color: white;
cursor: pointer;
font-size: 2em;
border-radius: 10px;
padding-bottom: 0;
}

Step Four (Bonus)

Additionally, you can style the CSS as you please. If you want to have the exact same button/effect that we have on PIT Designs website, use this CSS code:

#back-top {
display: none;
position: fixed;
bottom: 2.5em;
right: 0.7em;
border: white;
background-color: #40C351;
color: white;
cursor: pointer;
font-size: 2em;
border-radius: 10px;
padding-bottom: 0;
transition: 1s;
}#back-top:hover {
padding-bottom: 6em;
transition: 2s;
background: transparent;
color: transparent;
}

For any further clarifications/questions. Leave a comment below, or contact us.

3.9/5 (7 Reviews)
Do we all agree that Coffee is the fuel that feeds the free content creating?
6 Ecommerce Digital Marketing Tips for More Online Sales

Online sales are on the rise. Ever since the coronavirus pandemic broke out, people have switched to ecommerce. It has […]

7 Ideas for a Successful Online Business in 2021

Starting your own online business sounds both promising and challenging because it may have its advantages and disadvantages as well. […]

7 Steps To Write an Effective eCommerce Email Copy

Email marketing might be one of the oldest tricks in the digital marketing book, but it’s still going strong. It’s […]

Copywriting Strategies & Techniques To Skyrocket Conversion Rates

Top-notch copywriting is very similar to having a great salesperson selling your products or services around the clock. By learning […]

How to Make Your Office Ready for 2021 Come Back

The current COVID-19 virus has one thing in common with every other traumatic event throughout human history. It will eventually […]

Website Copyright Laws for Online Business

If you are starting a business and are working to build and promote it, there are some important things to […]

Wave Video for Social Media Video Marketing

Social media video marketing is the hottest trend and the most effective marketing tool. It helps reach masses of the […]

Leave a Reply

Your email address will not be published. Required fields are marked *

13 comments on “How to Add Back To Top Button in Oxygen Builder”

  1. I can't get this to work, It generates an arrow at the very bottom left of the page, inside a white bar. so you only see it when you reach the very bottom.

    1. Hi Jim,
      I think you're missing on the CSS part.. Would you recheck if you have it correctly? or post your page URL, I'll have a look.

  2. Neat, but it isn't scrolling for me. I have a sticky header if that makes a difference. Also, what do you mean "main css style sheet"? Where would one find that?
    Thank you

    1. Hi Randall,
      That's any external CSS sheet (if you have a main/master CSS stylesheet)
      Or you can simplely paste the CSS code in the same Code Block (CSS box) you'll use to add the HTML and JavaScript (from Step One)

    1. You can use CSS scroll behavior

      html {
      scroll-behavior: smooth;
      }

      Or Oxygen's builtin smooth scrolling (I haven't tried it but should be straight forward)
      Manage > Settings > Page Settings > Scripts

    1. Hi Azel,
      Did you assign the correct ID?
      Also, if you're using it on the template, remove it from other individual pages.
      It should work. What you see on this blog post is actually setup on a blog template.

  3. Good day Ninos,

    Thank you. Very practical. I have tried the various page options that you mentioned to get the scroll run smooth, but that did not work. Your other suggestion was enough:

    html{
    scroll-behavior: smooth;
    }

    1. Hi, it must be this part (HTML Code , step one)

      you can change the symbol with "up" and try :

      I tried checking the site schweizer-rechtsanwalt.com but it doesn't seem you've enabled it?
      feel free to send the demo link will check.

      thanks for the coffee 🙂

  4. It's awesome, thanks for the detailed tutorial. I would like to ask is there any way to change the scroll depth for appear the button? i.e. 50% or 60% scroll depth then it appears.

chevron-downmenu-circlecross-circle