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
  • Views 1.1k
  • Created
  • Last Reply

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment


This topic is now archived and is closed to further replies.

  • 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.