Hello Shopify community!
I am using the MINIMAL shopify theme and would like to add some CSS to allow the product image to change to the second allocated image when a user hovers over it.
My website is www.fortldn.com
Thanks so much for your help.
Hello Shopify community!
I am using the MINIMAL shopify theme and would like to add some CSS to allow the product image to change to the second allocated image when a user hovers over it.
My website is www.fortldn.com
Thanks so much for your help.
Step 1: Add CSS to your stylesheet
To add a hover effect, you will need to add some CSS code to your theme’s stylesheet:
Step 2: Edit the code for your product images
To edit the code for your product images:
In the Snippets directory, click product-grid-item.liquid.If your theme doesn’t have a product-grid-item.liquid file, then look for one of the following:
Find the HTML img tag for your product images by searching for:
1 |
<img |
|---|
The code for the tag varies theme to theme, but always starts with <img, and ends with either > or />. It might look similar to this:
|
1
|
|
| - | - |
On a new line above the img tag, paste the following code:
1 |
|---|
On a new line below the img tag, paste the following code:
1 |
|---|
The result should look like this:
|
1
2
3
|
On a new line below the img tag and above the closing tag, add the code that changes what is shown on hover. The code that you add will vary depending on whether you want to show an alternate product image, custom text, or a combination of the two.
Step 3: Show an alternate product image on hover
On a new line below the img tag and above the closing tag, paste the following code:
|
1
|
|
| - | - |
Your code should look like this:
|
1
2
3
4
|
Click Save.
Hi @FORTLondon
Please check the below link:
https://fortldn.com/collections/glassware
I have implemented the hover changes for you that you want.
Thanks!
Hello,
Thank you so much for this! It looks great, however I would like the second
image listed to be the image that shows when hovering over the first
product image. Is that ok?
Thanks so much,
Rosanna
Hi @FORTLondon
Sure, we have made the changes, please check and share your comments.
https://fortldn.com/collections/glassware
Once it will work then, do not forget to like and accept the solution ![]()
Thanks!
Hello,
Sorry maybe you did not understand - I would like the first image to remain
as it was, but upon hovering, the second image is the one which shows. I
think you had it as the last image which was the one which showed…
Thanks,
Rosanna
Hi @FORTLondon
Sorry I misunderstood.
I have fixed the it as per requirement.
https://fortldn.com/collections/glassware
Please check and let me know your comments.
Thanks!
This is great, thank you so much. Is there a way to stop it from saying ‘no
image’ when there is no second image? Maybe the image stays the same when
you hover?
Thanks,
Rosanna
Hi Rosanna,
Sure, please check now, we have made the changes for you.
Thanks!
Thank you so much, this all looks greta. Will this happen automatically now
with every product we add?
Thank you.
Yes @FORTLondon , it will work with the new products as well ![]()
Great, thank you so much! This is all good.
Hi @FORTLondon
I hope you got your answer now ![]()
Kindly like and accept the solution so, other people got the correct answers.
Thanks!
Hi, I’m working out of Minimal Theme and I can only find theme.scss.liquid in Assets. There is no css.liquid files. Will this work the same?
Thank you
This solution doens’t seem to apply to Minimal Theme. I have tried to implement the code but there is only scss.liquid files.
Anyone can suggest a different solution.
Hi was able to find a local developer who helped.
Hi Prezentech.
I’m using the Venture theme and I have a bunch of apps installed that may or may not be messing with the code. I’m no expert. I’ve tried your tutorial and I tried another tutorial by ecomexperts.io which were very similar and neither tutorial worked.
Could I send you a invitation to contribute on my code?
My website is https://everlastinggodkings.com/
Can you please create the staff account for info@prezentech.com so we can check in the theme?
Prezentech I’ve just sent you a collaborator code to the email you specified.
Thank you friend!!