Jump to content

Custom button animation

Go to solution Solved by Beyondspace,

Recommended Posts

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
Link to comment
  • Replies 2
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution
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 (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 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

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.