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 4 years ago on July 16th, 2019. Last modified on October 29th, 2021

Related To:

How a Rephraser can Help you Improve your Social Media Presence

Having a problem with your social media content? Too much competition to deal with? Worry not! Here is how a Rephraser can help.

How Automation Software Help with Payroll Processing

Automation software greatly reduces payroll processing errors, enhances compliance, increases efficiency, and makes paychecks easier to create and file. Automation […]

How To Stay Safe While Surfing The Internet

The Internet is a part of our everyday life nowadays. Every day we spend a good amount of time on […]

Business Books Entrepreneurs Must Read to Dominate Their Industry

Whether you aspire to start a small business or launched a digital marketing agency, you must spend sufficient time reading […]

The Creative Entrepreneur: Exploring Career Opportunities for Innovators and Problem-Solvers

All entrepreneurs need problem-solving and innovative skills. Finding solutions or creating new possibilities is accomplished through problem-solving. The ability to […]

Top 2D Animation Tools in 2023

Shopping for 2D animation software for your next project? Here are five of the best 2D Animation tools that are worth exploring.

Is Link Building Essential for WordPress Website

In current digital marketing, inbound link creation directly correlates with online success. Link building is all about gaining inbound connections, […]

What and How Web-Based CRM Matter for Your Business

As a business owner, you know that maintaining strong customer relationships is crucial for success. A customer relationship management (CRM) […]

The 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, with one click. Without having to scroll all the way back up. Especially on blog posts, with long articles. 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.