Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CSS for Reveal module
/* ===============================================
// Reveal module
// =============================================== */
.reveal .hidden { display: block !important; visibility: visible !important;}
.product:hover .reveal img { opacity: 1; }
.reveal { position: relative; }
.reveal .hidden {
position: absolute;
z-index: -1;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
-webkit-transition: opacity 0.3s ease-in-out;
-moz-transition: opacity 0.3s ease-in-out;
-o-transition: opacity 0.3s ease-in-out;
transition: opacity 0.3s ease-in-out;
}
.reveal:hover .hidden {
z-index: 100000;
opacity: 1;
}
.reveal .caption {
position: absolute;
top: 0;
display: table;
width: 100%;
height: 100%;
background-color: white; /* fallback for IE8 */
background-color: rgba(255, 255, 255, 0.7);
font: 13px/1.6 sans-serif;
text-transform: uppercase;
color: #333;
letter-spacing: 1px;
text-align: center;
text-rendering: optimizeLegibility;
}
.reveal .hidden .caption .centered {
display: table-cell;
vertical-align: middle;
}
@media (min-width: 480px) and (max-width: 979px) {
.reveal .caption {
font-size: 11px;
}
}
@frblog

This comment has been minimized.

Copy link

frblog commented Mar 15, 2017

Can you please show me how to remove the opacity from the image hover? I've tried setting them all to 1 and had no such luck. Thank you!

@calvinwhitehurst

This comment has been minimized.

Copy link

calvinwhitehurst commented Jul 15, 2017

This is great. Thank you so much. I used this on our site to show multiple color variants of the same product. Hopefully this will give us a little boost in sales!

@heyjonmanning

This comment has been minimized.

Copy link

heyjonmanning commented Aug 17, 2017

@frblog control the opacity on line 31:

background-color: rgba(255, 255, 255, 0.7);

RGBA colors include transparency as the last number, so that's white with 70% opacity.

0 is fully transparent and 1 is fully opaque.

@shuvie

This comment has been minimized.

Copy link

shuvie commented Oct 15, 2017

hi, thank you very much for this.
I've tried changing line 31 as @heyjonmanning said, to background-color: rgba(255, 255, 255, 0);
but it is still not opaque when hover over..

any idea?

@aprdw

This comment has been minimized.

Copy link

aprdw commented Nov 2, 2017

Thanks for the code! Is it possible to fully remove the opacity when an image when an image is hovered over?

I tried changing the opacity on line 31, but it did not work.

@Chakra-tea

This comment has been minimized.

Copy link

Chakra-tea commented Jan 24, 2018

Hi there
I am wondering if it is possible to use this hover effect on the Variant images on a product page (using Minimal) - rather than the featured images?

And where does one find that? I have looked prior but can't seem to locate them.
Thanks so much - love to be able to use this.

@robinholland00

This comment has been minimized.

Copy link

robinholland00 commented Jan 26, 2018

He there, i am trying to implement this hover effect onto the debut theme, with no luck at all. It's not affecting anything to be honest.

Can you give me any pointers?

@harisbabic

This comment has been minimized.

Copy link

harisbabic commented Jan 31, 2018

@shuvie , @aprdw
If you go to your css theme file - theme.scss.liquid --> do a search and find a variable called $opacity-link-hover
Opacity is on 0.6 by default.
$opacity-link-hover: 0.6;

If you change it to higher decimals or 1 , the hover image will not have the white overlay..
Cheers

@Osotoro

This comment has been minimized.

Copy link

Osotoro commented Feb 11, 2018

Great work! Thank you so much!

@shilpsd

This comment has been minimized.

Copy link

shilpsd commented Mar 3, 2018

Hi, I have implemented this to my store which is built on shopify brooklyn theme, The hover appears to be working as expected on the product pages, however on the home page displaying featured images, the image appears as stretched. Please suggest any modifications. Thanks.

@anantrao07

This comment has been minimized.

Copy link

anantrao07 commented Mar 26, 2018

Hi I have implemented this to my store .The hover turns out to be working only on few products not all of them and the images appears as stretched. Please suggest any modifications. Thanks.

@Alixdb

This comment has been minimized.

Copy link

Alixdb commented Apr 10, 2018

Hey! That's awesome thanks, it works great. Could you please explain how to remove the zoom effect? It seems like my hover effect is making a zoom on my hover picture, and it is changing the size of it, which I don't want to happen. Thanks a lot again! :)

@bbzhou

This comment has been minimized.

Copy link

bbzhou commented May 10, 2018

Hi I have tried this to my Debut themed store on shopify, everything works except the images appears stretched. All of my photos are squares, but somehow the photos that reveal after the hover are stretched as stretched rectangles. Please help :)

@jane2230

This comment has been minimized.

Copy link

jane2230 commented May 20, 2018

Hello!) @harisbabic ; @heyjonmanning ; I have Brooklyn theme. Everything works great, I want to delete white background effect, but I can't find $opacity-link-hover in my SCSS at all, and it also does not change in line 30/31. Someone know how to change it and get rid of this background?
Jane.

@leojustrockit

This comment has been minimized.

Copy link

leojustrockit commented Jun 13, 2018

Hi @jane2230 I have found the location in Brooklyn theme. It is in line 3295.
&:hover,
&:focus {
opacity: 0.9;
@include transition(opacity 0.15s ease-in);
You could change the opacity to higher decimals or 1.

@directabe

This comment has been minimized.

Copy link

directabe commented Jun 13, 2018

@leojustrockit
&:hover,
&:focus {
opacity: 0.9;
@include transition(opacity 0.15s ease-in);
You could change the opacity to higher decimals or 1.
like this ???

&:hover,
&:focus {
opacity: 0.1;
@include transition(opacity 0.15s ease-in);

@zackczj

This comment has been minimized.

Copy link

zackczj commented Jul 11, 2018

I am on a brooklyn theme, is this code outdated? My file is a scss.liquid file instead of css.liquid file.

Tried using this code, doesn't seem to work.

@whoischrislopez

This comment has been minimized.

Copy link

whoischrislopez commented Jul 15, 2018

Hello, I am using the Debut theme on Shopify and have the product title and product price hover effect working with a few issues. The products are pushed down by invisible products that were not there before (reference image attached). The colored background is not vertically center aligned to the product and the background color only fills the height and width of the text and not the whole product itself. Can I get any help removing the space above products, vertically aligning the product title/price, and setting the height and width of the background color to match that of the product?

@Interfacehunt

This comment has been minimized.

Copy link

Interfacehunt commented Jul 17, 2018

Guys I've been trying this on my Brooklyn theme for a week and it doesn't work! If anyone has managed to implement this on brooklyn theme, please HELP!

@saiancha1

This comment has been minimized.

Copy link

saiancha1 commented Aug 6, 2018

@Interfacehunt I used the debut theme and had to change the position of grid-view-item__image from absolute to relative in order for it to work. See if you can make the change in your theme.

@domix90

This comment has been minimized.

Copy link

domix90 commented Aug 10, 2018

@saiancha1 Hey, could you post the code in the final form that worked for you? What exactly did you change? I am also on Debut.

How did you set up the photos in the shopify admin for the photo to be displayed?

@domix90

This comment has been minimized.

Copy link

domix90 commented Aug 10, 2018

image

I have this issue - the slide bar on the right. How to get rid of it?

@AlbieGH

This comment has been minimized.

Copy link

AlbieGH commented Oct 11, 2018

Hello there! I'm trying the code on the Minimal theme, but when I add the extra code from the Shopify guide (https://help.shopify.com/en/themes/customization/collections/add-hover-effect-to-product-images), all the images disappear.
I am adding the extra code from the guide to my product-grid-item.liquid snippet, ...which looks a bit different from what's in the guide actually - I'll paste part of the snippet below.
The guide says I have to create a div class="reveal" around the img tag and then add <img class="hidden" src="{{ product.images.last | img_url: 'large' }}" alt="{{ product.images.last.alt | escape }}" /> right before the end of that div.
I tried adding the extra code both to the first img tag and to all 3 of the img tags I found on that product-grid-item.liquid snippet. The result is the same, the images disappear.
Any clue?

Here is a good portion of the product-grid-item.liquid snippet:

<span class="grid-link__image-centered">
        {% if featured.title != '' %}
          {% unless featured.featured_image == blank %}
            {% capture img_id %}ProductImage-{{ featured.featured_image.id }}{% endcapture %}
            {% capture wrapper_id %}ProductImageWrapper-{{ featured.featured_image.id }}{% endcapture %}
            {%- assign img_url = featured.featured_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}

            {% include 'image-style' with image: featured.featured_image, width: product_width, height: 480, wrapper_id: wrapper_id, img_id: img_id %}
            <div id="{{ wrapper_id }}" class="product__img-wrapper supports-js">
              <div style="padding-top:{{ 1 | divided_by: featured.featured_image.aspect_ratio | times: 100}}%;">
/*================ I added the div here and closed it correctly ================*/
                  <img id="{{ img_id }}"
                     class="product__img lazyload"
                     src="{{ featured.featured_image | img_url: '300x300' }}"
                     data-src="{{ img_url }}"
                     data-widths="[150, 220, 360, 470, 600, 750, 940, 1080, 1296, 1512, 1728, 2048]"
                     data-aspectratio="{{ featured.featured_image.aspect_ratio }}"
                     data-sizes="auto"
                     alt="{{ featured.featured_image.alt | escape }}">
              </div>
            </div>
          {% else %}
              <img src="{{ featured.featured_image.src | img_url: 'large' }}" alt="{{ featured.featured_image.alt | escape }}" class="product__img">
          {% endunless %}
          <noscript>
              <img src="{{ featured.featured_image.src | img_url: 'large' }}" alt="{{ featured.featured_image.alt | escape }}" class="product__img">
          </noscript>
        {% else %}
          {% capture current %}{% cycle 1, 2, 3, 4, 5, 6 %}{% endcapture %}
          {{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
        {% endif %}
      </span>
@madebymle

This comment has been minimized.

Copy link

madebymle commented Oct 25, 2018

Hi there, I am trying to use this update for the Cascade theme in Shopify and it is not working for me. Can you please tell me how I can get this to work for the Cascade theme?

Thank you!

@krittleb

This comment has been minimized.

Copy link

krittleb commented Feb 22, 2019

Does this code no longer apply? I am using Canopy theme and the only style sheet is styles.scss.liquid. I have added all of the code mentioned very carefully, and nothing happening. I turned off the "Quick Buy" option in Canopy theme thinking maybe it was conflicting as it puts a little banner on top of the main image, but still no go.

@smartcraig1

This comment has been minimized.

Copy link

smartcraig1 commented May 23, 2019

The code no longer works on Brooklyn or just for me, any tip?

@jasonchosen

This comment has been minimized.

Copy link

jasonchosen commented Aug 26, 2019

image

I have this issue - the slide bar on the right. How to get rid of it?

Hello @domix90 did you ever get an answer for this?

@legrosbail

This comment has been minimized.

Copy link

legrosbail commented Sep 9, 2019

Does this code no longer apply? I am using Canopy theme and the only style sheet is styles.scss.liquid. I have added all of the code mentioned very carefully, and nothing happening. I turned off the "Quick Buy" option in Canopy theme thinking maybe it was conflicting as it puts a little banner on top of the main image, but still no go.

Hi Krittleb , Did you ever manage to resolve the issue??? Trying to do this on my canopy.

@domix90

This comment has been minimized.

Copy link

domix90 commented Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.