Jump to content

how to change my back to top button with an arrow

Go to solution Solved by Beyondspace,

Recommended Posts

hi. I created a "back to top" button for my website. it's just a circle actually. I want to add an arrow into the circle to make it more clear.  

here is my codes:

 

-TO THE HEADER-

<a href="#" class="btt"> <span class="btt-icon"></span> </a>
- TO THE FOOTER -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
  var scrolled = 400; $(window).scroll(function() {
    if ( $(window).scrollTop() > scrolled ) {
      $('a.btt').fadeIn('slow');
    } else {
      $('a.btt').fadeOut('slow');
    }
  });
</script>
<script>
  $('a.btt').click(function() {
    $('html, body').animate({ scrollTop: 0 }, 700);
    return false;
  });
</script>
- CSS -

a.btt {
  display: block;
  position: fixed;
  z-index: 999;
  width: 45px;
  height: 45px;
  right: 30px;
  bottom: 30px;
  background: white;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  border-radius: 30px;
  box-shadow: 3px 3px 10px rgba(23, 25, 25, 0.2);
  transition: transform 0.3s ease-in-out;
}

 

Screenshot 2023-01-30 at 16.01.33.png

Link to comment
  • Replies 3
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

  • Solution
1 hour ago, buura said:

hi. I created a "back to top" button for my website. it's just a circle actually. I want to add an arrow into the circle to make it more clear.  

here is my codes:

 

-TO THE HEADER-

<a href="#" class="btt"> <span class="btt-icon"></span> </a>
- TO THE FOOTER -

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
  var scrolled = 400; $(window).scroll(function() {
    if ( $(window).scrollTop() > scrolled ) {
      $('a.btt').fadeIn('slow');
    } else {
      $('a.btt').fadeOut('slow');
    }
  });
</script>
<script>
  $('a.btt').click(function() {
    $('html, body').animate({ scrollTop: 0 }, 700);
    return false;
  });
</script>
- CSS -

a.btt {
  display: block;
  position: fixed;
  z-index: 999;
  width: 45px;
  height: 45px;
  right: 30px;
  bottom: 30px;
  background: white;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  border-radius: 30px;
  box-shadow: 3px 3px 10px rgba(23, 25, 25, 0.2);
  transition: transform 0.3s ease-in-out;
}

 

Screenshot 2023-01-30 at 16.01.33.png

You can add the following code to get the arrow

a.btt {
  background-image:  url('https://api.iconify.design/material-symbols/arrow-upward.svg?color=%23626262');
  background-repeat: no-repeat;
  background-position: center center ;
  background-size:contain;
}

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment

My testing

image.png.3c5ad1850bcadd07db2d3cfc5a71aa8c.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace (+100 Spark plugin customisations)
🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

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.