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
  • 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)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget 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)
🗓️ Delivery Date Picker (Squarespace Date format)
💫 Animated Buttons (Referral URL)
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget 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
5 minutes ago, Beyondspace said:

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;
}

 

thanks! 

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.