Site logo

Archived topic

CSS conflict with secondary product image display on hover

6 replies · Started by Raul on June 11, 2020

Viewing posts 1–7 of 7

Hi guys,

When I add this code:


.woocommerce ul.products li.product img,
.woocommerce ul.products li.product img .secondary-image{
    -webkit-filter: saturate(0.9) brightness(105%) contrast(101%);  /* Opera, Chrome, Safari */
    filter: saturate(0.9) brightness(105%) contrast(101%);
}

The secondary WooCommerce product image doesn't get displayed on mouse hover. I guess the problem is the primary image is not affected by opacity=0, correct? Any idea how to solve it?

Also, if I remove this code and the secondary image does not have exactly the same dimensions of the first one, the first is still visible on the background.

Thanks!

Hi there,

not sure but you can try using this CSS:

.wc-has-gallery img:hover {
    opacity: 0 !important;
}

.wc-has-gallery .secondary-image:hover {
    opacity: 1 !important;
}

Works perfectly!

Thanks so much

What is the issue here? Which block of CSS is causing the issue?

Hi Leo,

I was able to make it work!

I added

.post-type-archive-product

to David's code to target the product archive only.

Glad to hear :)

This archived topic is closed to new replies.