Jump to content

Custom button animation

Go to solution Solved by Beyondspace,

Recommended Posts

Posted (edited)

Hi!

I am designing a website. I am trying to get the button animation to look like this website:
https://www.mcgeeandco.com/


It works when the button is on fill, but I am trying to figure out how to get the animation to fit inside the box when the button is set to fit.

My site: https://purple-gar-wesk.squarespace.com/?password=demo

Here is my code:


.sqs-block-button-element--medium {
  border: 1px solid #515151 !important;
  transform: perspective(0p);
  color:var(--primaryButtonBackgroundColor) !important;
}

.sqs-block-button-element--medium:before {
content: "";
position: absolute;
  display: flex;
top: 0;
right:0;
  bottom:0;
left: 0;
  z-index:-1;
background: #a97d6E;
  transform: scaleY(0);
  transform-origin: 50% 100%;
transition: 0.4s;
}

.sqs-block-button-element--medium:hover {
  color:white !important;
  border: 1px solid #a97d6e !important;
  opacity: 1 !important;
}
.sqs-block-button-element--medium:hover:before {
transform: scaleY(1);
}


Would love help! Thank you!

- Erika

Edited by erikapruett
  • Replies 2
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution
Posted
On 4/14/2024 at 6:25 AM, erikapruett said:

Hi!

I am designing a website. I am trying to get the button animation to look like this website:
https://www.mcgeeandco.com/


It works when the button is on fill, but I am trying to figure out how to get the animation to fit inside the box when the button is set to fit.

My site: https://purple-gar-wesk.squarespace.com/?password=demo

Here is my code:


.sqs-block-button-element--medium {
  border: 1px solid #515151 !important;
  transform: perspective(0p);
  color:var(--primaryButtonBackgroundColor) !important;
}

.sqs-block-button-element--medium:before {
content: "";
position: absolute;
  display: flex;
top: 0;
right:0;
  bottom:0;
left: 0;
  z-index:-1;
background: #a97d6E;
  transform: scaleY(0);
  transform-origin: 50% 100%;
transition: 0.4s;
}

.sqs-block-button-element--medium:hover {
  color:white !important;
  border: 1px solid #a97d6e !important;
  opacity: 1 !important;
}
.sqs-block-button-element--medium:hover:before {
transform: scaleY(1);
}


Would love help! Thank you!

- Erika

You can try this code

.sqs-block-button-element--medium {
  border: 1px solid #515151 !important;
  transform: perspective(0p);
  color: #515151 !important;
  position: relative;
}

.sqs-block-button-element--medium:before {
  content: "";
  position: absolute;
  display: flex;
  top: 0;
  right:0;
  bottom:0;
  left: 0;
  z-index:-1;
  background: #a97d6E;
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: 0.4s;
}

.sqs-block-button-element--medium:hover {
  color:white !important;
  border: 1px solid #a97d6e !important;
  opacity: 1 !important;
}
.sqs-block-button-element--medium:hover:before {
  transform: scaleY(1);
}

Let me know how it works

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

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.