Jump to content

Remove a "back to top" Button from Mobile View

Recommended Posts

Site URL: https://www.neemaproject.org/

Hello! Would anyone be able to help me remove a "back to top" button from mobile view? Or edit it so that it works on mobile? The website is www.neemaproject.org and the code injected on the main home page is this: 

  .back-to-top {
    background-color: #000000;
    color: #FFFFFF;
    opacity: 0;
    transition: opacity .6s ease-in-out;
    z-index: 999;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    box-sizing: border-box;
    border-radius: 50%;

  a.back-to-top {
    font-weight: 1000;
    letter-spacing: 2px;
    font-size: 12px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.6;
    padding-left: 2px;
    padding-top: 16px;

  .back-to-top:hover, .back-to-top:focus, .back-to-top:visited {
    color: #FFFFFF;

  .back-to-top.show {
    opacity: 1;

<!-- Adds the back to top link to your website -->
<a href="#" id="back-to-top" class="back-to-top" style="display: inline;">TOP</a>

<!-- Fades in the button when you scroll down -->
  var link = document.getElementById("back-to-top");
  var amountScrolled = 250;

  window.addEventListener('scroll', function(e) {
      if ( window.pageYOffset > amountScrolled ) {
      } else {
          link.className = 'back-to-top';

<!-- Scrolls to Top -->
  link.addEventListener('click', function(e) {

      var distance = 0 - window.pageYOffset;
      var increments = distance/(500/16);
      function animateScroll() {
          window.scrollBy(0, increments);
          if (window.pageYOffset <= document.body.offsetTop) {
      // Loop the animation function
      var runAnimation = setInterval(animateScroll, 16);

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Add to Design > Custom CSS

/* remove back to top mobile */
@media screen and (max-width:767px) {
.back-to-top {
	display: none !important;

Or follow this guide to add back to top, works on both mobile & desktop.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.