Jump to content

Floating button only appears upon site reload. Help please!

Go to solution Solved by tuanphan,

Recommended Posts

Hi all!

Firstly, I appreciate your time and effort in helping fellow Squarespace users out!

Here is my problem: I have added a floating button using custom CSS. I have no experience with coding and followed a template I found on someone's blog. After intuitively tweaking a few things to make the button appear and work, it now only displays upon reloading the page. In other words: it doesn't show upon initially landing on the site. 

The website is: www.jomartinosteopathy.com.au

I'm grateful for any help and suggestions!

Sincerely,

Jo

Edited by JMOsteo
Link to comment
  • Replies 10
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

I used 2 lots of code. One in the page header, another one in the 'Custom CSS' section under 'website tools'.

The page header code is this:

<meta name="robots" content="noindex">
<div id="floating-button">
  <a href="/np-morn"> More appointments here </a>
</div>

 

The Custom CSS code is this: 

#floating-button {
  position: fixed;
  top: 50%;
  right: 0;
  transform: rotate(90deg) translateX(50%);
  transform-origin: 100% 0;
  z-index: 99999;
}
#floating-button a {
  background: #0E0793;
  color: white;
  display: inline-block;
  font-size: 14px;
  text-transform: uppercase;
  font-family: montserrat;
  font-weight: 400;
  letter-spacing: 0.3em;
  padding: 10px 30px;
  border-radius: 0px 0px 10px 10px;
  transition: ease 0.5s !important;
}
#floating-button a:hover {
    padding: 20px 40px;
  background: #2E52FF;
  }
@media screen and (max-width: 768px) {
  #floating-button {
    bottom: 0;
    top: auto;
    transform: none;
    left: 0;
    text-align: center !important;
  }

  #floating-button a {
    padding: 10px 0px;
    border-radius:10px 10px 0px 0px !important;
    width: 100% !important;
  }

}

*/

Link to comment

It looks like you havent' added code to Custom CSS yet (or you added to wrong "CSS section"

Don't remove code from your Page Header

Add this code to Custom CSS box (see screenshot below)

#floating-button {
  position: fixed;
  top: 50%;
  right: 0;
  transform: rotate(90deg) translateX(50%);
  transform-origin: 100% 0;
  z-index: 99999;
}
#floating-button a {
  background: #0E0793;
  color: white;
  display: inline-block;
  font-size: 14px;
  text-transform: uppercase;
  font-family: montserrat;
  font-weight: 400;
  letter-spacing: 0.3em;
  padding: 10px 30px;
  border-radius: 0px 0px 10px 10px;
  transition: ease 0.5s !important;
}
#floating-button a:hover {
    padding: 20px 40px;
  background: #2E52FF;
  }
@media screen and (max-width: 768px) {
  #floating-button {
    bottom: 0;
    top: auto;
    transform: none;
    left: 0;
    text-align: center !important;
  }

  #floating-button a {
    padding: 10px 0px;
    border-radius:10px 10px 0px 0px !important;
    width: 100% !important;
  }
}

image.png.b159d6cc819be4b9f2b0753934bc615b.png

image.png.3114c5bb022a9917e86e14f0ceffbbe3.png

image.thumb.png.45dc21d1a408a8050d2e9865261063d0.png

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

Thank you. I've added the code, however there was already custom code in the section you mentioned I should ad. So, I've deleted the old code (below for your reference) and added yours. The problem persists.

This is what's in 'custom css' now:

/*

.btt {
  color: grey;
  font-weight: bold;
  text-align: center;
  display: block;
}
#block-ccf38b9fa5ecb298c108 {
  border-right: 2px solid #ccc;
}
#block-yui_3_17_2_1_1675821262885_78076 h3{
  color: #F53831;
  font-size: 28px;
 
}
 .Header-nav-item--folder a {
 pointer-events: none;
 }
 .Header-nav-folder-item {
 pointer-events: auto !important;
 }
#floating-button {
  position: fixed;
  top: 50%;
  right: 0;
  transform: rotate(90deg) translateX(50%);
  transform-origin: 100% 0;
  z-index: 99999;
}
#floating-button a {
  background: #0E0793;
  color: white;
  display: inline-block;
  font-size: 14px;
  text-transform: uppercase;
  font-family: montserrat;
  font-weight: 400;
  letter-spacing: 0.3em;
  padding: 10px 30px;
  border-radius: 0px 0px 10px 10px;
  transition: ease 0.5s !important;
}
#floating-button a:hover {
    padding: 20px 40px;
  background: #2E52FF;
  }
@media screen and (max-width: 768px) {
  #floating-button {
    bottom: 0;
    top: auto;
    transform: none;
    left: 0;
    text-align: center !important;
  }

  #floating-button a {
    padding: 10px 0px;
    border-radius:10px 10px 0px 0px !important;
    width: 100% !important;
  }
}

*/

 

 

And here's the old code: 

 

#floating-button {
  position: fixed;
  top: 50%;
  right: 0;
  transform: rotate(90deg) translateX(50%);
  transform-origin: 100% 0;
  z-index: 99999;
}
#floating-button a {
  background: #0E0793;
  color: white;
  display: inline-block;
  font-size: 14px;
  text-transform: uppercase;
  font-family: montserrat;
  font-weight: 400;
  letter-spacing: 0.3em;
  padding: 10px 30px;
  border-radius: 0px 0px 10px 10px;
  transition: ease 0.5s !important;
}
#floating-button a:hover {
    padding: 20px 40px;
  background: #2E52FF;
  }
@media screen and (max-width: 768px) {
  #floating-button {
    bottom: 0;
    top: auto;
    transform: none;
    left: 0;
    text-align: center !important;
  }

  #floating-button a {
    padding: 10px 0px;
    border-radius:10px 10px 0px 0px !important;
    width: 100% !important;
  }

}

 

Any other ideas?

 

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.