- This topic has 34 replies, 2 voices, and was last updated 2 years, 7 months ago by
Fernando.
-
AuthorPosts
-
April 5, 2020 at 4:21 pm #1227869
John MacKenzie
ok so ive done a bunch of searching on this and cant seem to find any real answer if its possible or should work.
basically to get images to look right i have the ratio of images set to show as 1:1 so they are all the same size. This causes some to not show fully.
my client was wondering if there is a way to have a hover effect when on category pages (showing a list of products) so that when one hovers over an image it expands to the proper dimensions to show the full image (not necessary size, but just the fully image itself?)
thanks!
JohnApril 6, 2020 at 2:38 am #1228178David
StaffCustomer SupportHi there,
could be doable with some CSS. But first you would need to set the Product Images to their original sizes or at least aspect ratio. Then we can try some CSS to force them to look cropped and apply the zoom hover effect …… well at least thats the plan.
April 6, 2020 at 1:48 pm #1229048John MacKenzie
oh wow ok thanks, amazed there isnt a plugin for this. ive set it to uncropped for now, thanks!!
April 6, 2020 at 6:22 pm #1229215David
StaffCustomer SupportTry adding this CSS:
body:not(.single) .inside-wc-product-image { width: 300px; height: 300px; overflow: hidden; display: flex; align-items: center; margin: auto; } body:not(.single) .woocommerce ul.products li.product a img { width: 100%; height: 100%; object-fit: cover; } body:not(.single) .woocommerce ul.products li.product:hover a img { object-fit: contain; }
April 6, 2020 at 6:56 pm #1229235John MacKenzie
thanks!!
I tried that and almost there however the images are now pushed off the right of the screen
thanks so much!
John
April 7, 2020 at 2:48 am #1229553David
StaffCustomer SupportDid you resolve it ? It looks fine to me – maybe the browser cache needed clearing. Let me know.
April 7, 2020 at 8:40 am #1230036John MacKenzie
nope if you go to /art-category/textile/ you will see what i mean.
thanks!
JohnApril 7, 2020 at 8:48 am #1230058David
StaffCustomer SupportOh yeah lol – add this extra CSS to reduce there sizes for those desktop views where the sidebar takes up space:
@media(min-width: 1024px) { body:not(.single) .inside-wc-product-image { width: 200px; height: 200px; } }
April 7, 2020 at 9:14 am #1230098John MacKenzie
Thanks! added but it didnt seem to change anything (tried different browsers?)
thanks for your help
John
April 8, 2020 at 1:31 am #1230844David
StaffCustomer SupportCan you move that CSS below the original CSS i provided.
April 8, 2020 at 12:10 pm #1231717John MacKenzie
thanks i tried that still seems the same?
thanks!
April 8, 2020 at 3:10 pm #1231831David
StaffCustomer SupportCan you remove all of that CSS i provided and try this:
body:not(.single) .inside-wc-product-image { width: 300px; height: 300px; overflow: hidden; display: flex; align-items: center; margin: auto; } @media(min-width: 1024px) { body:not(.single) .inside-wc-product-image { width: 200px !important; height: 200px !important; } } body:not(.single) .woocommerce ul.products li.product a img { width: 100%; height: 100%; object-fit: cover; } body:not(.single) .woocommerce ul.products li.product:hover a img { object-fit: contain; }
April 8, 2020 at 4:11 pm #1231880John MacKenzie
awesome thanks!
last question is there anyway to make the images get larger on hover instead of smaller?
Thanks alot!
April 9, 2020 at 2:51 am #1232229David
StaffCustomer SupportI had a look – but i couldn’t see an easy way to do that with the Woo markup – what makes it difficult is that some images are landscape and some are portrait.
April 9, 2020 at 9:29 am #1232875John MacKenzie
ok thanks so much!!
John
-
AuthorPosts
- You must be logged in to reply to this topic.