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:


pCloud Lifetime 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.

Do we all agree that Coffee is the fuel that feeds the free content creating?
Dive Yourself into the World of Fashion and their Logo Diaries

One often gets inspired by some people’s fashion looks. The demeanor in which they carry themselves is loaded with fascination. […]

How Low Code Development Is Changing Mobile App Industry

These days building apps is on the high rise for both enterprises and non-programmers without any engineering efforts. In other […]

Office Removals, Workplace Relocation, Commercial & International Moving

Relocating a commercial space or an office is not everyone's cup of tea. It involves a lot of technicalities and […]

The Importance of UI & UX for Digital Marketing Strategy

It’s a well-known fact that both paid and organic media strategies can bring a certain level of success, but even […]

5 Ways To Build Brand Authority in Your Field

As a business owner, you should always be looking for ways to build up your reputation and brand authority. Having […]

5 Tax Breaks Nonprofits Should Know About

Every business needs to manage money effectively well to be profitable, but non-profits need to be even more diligent due […]

6 Tips to Improve the Functionality of Your WordPress Build

Table of Contents Introduction:1: Powerlessness. 2. Install Plugins Selectively 3. Use proper Designs 4. Utilize HTML5 5. Make Your Route Simple & Obvious 6. Basic […]

menu-circlecross-circle