We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Changing the hover effect for the products.

Changing the hover effect for the products.

CreatorTim
Navigator
471 1 71

Hey guys,

I want to change the hover effect for the products.

 

Currently, I have the default Shopify animation. I’d like to change it to a quick slide to the left.

 

The second thing I want is that when I hover over a product, a shopping bag icon with "Quick Buy" appears in a circle at the bottom-right corner.

 

I want everything to look exactly like it does here: https://tomnoske.store/collections/all-products

 

And here’s my store URL: https://1049xn-ya.myshopify.com/collections/all

 

Thanks so much,
Tim

Replies 2 (2)

mageplaza-cs
Shopify Partner
567 46 87

@CreatorTim ,
I am from Mageplaza - Shopify solution expert.

To change the hover effect for product items in your Shopify store, you'll need to modify the CSS in your theme. Here are some suggestions you can follow to achieve that: 

  1. Identify the Product Card Class:
  • Go to your Shopify theme editor (Online Store > Themest > Cusomize).
  • Inspect the product grid or product list on your store using your browser's developer tools (Right-click > Inspect).
  • Identify the class or ID of the product card/container (e.g., .product-card, .product-grid-item,). In your case, is (.card__inner)

 

     2. Add Custom CSS:

 

  • Navigate to your theme's theme.css or styles.css file in the Shopify code editor (Online Store > Themes > Edit Code).
  • Locate the relevant stylesheet, or add the styles in the Assets folder.

   3. Here is an example: 

  • Example HTML structure:

 

<div class="product-card">
  <div class="product-card__image-wrapper">
    <img src="main-image.jpg" alt="Product Image" class="product-card__image">
    <img src="hover-image.jpg" alt="Hover Image" class="product-card__hover-image">
  </div>
  <div class="product-card__details">
    <h3 class="product-card__title">Product Name</h3>
    <p class="product-card__price">$49.99</p>
    <button class="product-card__cart-button">Add to Cart</button>
  </div>
</div>

 

  • Style the button: Use CSS to hide the button by default and make it visible when hovering over the product card:

 

/* General Styles */
.product-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #eaeaea;
  padding: 15px;
  text-align: center;
  transition: transform 0.3s ease;
}

.product-card:hover {
  transform: scale(1.05);
}

/* Image Wrapper */
.product-card__image-wrapper {
  position: relative;
  width: 100%;
  height: 200px; /* Adjust based on your design */
  overflow: hidden;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.product-card__hover-image {
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-card__hover-image {
  transform: translateX(-100%);
}

/* Details Section */
.product-card__details {
  position: relative;
  padding: 10px 0;
}

/* Cart Button */
.product-card__cart-button {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background-color: #000;
  color: #fff;
  border: none;
  padding: 10px 15px;
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.product-card:hover .product-card__cart-button {
  opacity: 1;
  visibility: visible;

 

  4. Save and test:

  • Save the changes and preview the store.
  • Adjust dimensions, colors, or positions as needed for your theme.

I hope this helps, please leave a comment if you need further instructions !

Mageplaza | Top-Rated Shopify Agency | Trusted by 230,000+ worldwide merchants


If our suggestion works for you, please give it a Like or mark it as a Solution!


Should you have any questions or concerns, feel free to contact us via consultant@mageplaza.com

CreatorTim
Navigator
471 1 71

Hey, thanks for the feedback!

However, all I did was add the CSS to the base.css file, but nothing changed. What should I do with the HTML? Should I add it somewhere or make any changes?


Thank again,

Tim