Add a hover effect to product images on your collection pages Supply theme no opacity

Solved
Highlighted
Tourist
9 0 1

Hello, so I used the tutorial from this link https://help.shopify.com/en/themes/customization/collections/add-hover-effect-to-product-images?utm_... but, I can't figure out what to do to have no opacity on the second image. Any help is welcome. Thanks

0 Likes
Tourist
9 0 1

Website https://perfectprintshot.ro   

Preview :prohff

0 Likes
Highlighted
Shopify Partner
454 64 128

Can you post a link to the actual product page where you have made this change as I can't seem to find one on your site.

 

Also please post your custom CSS because the CSS in that article has numerous parts that are setting an opacity so would be good to see which ones you've already tried to change.

If helpful then please Like and Accept Solution
0 Likes
Highlighted
Tourist
9 0 1

It's on the first page,

Custom css from product-grid-item.liquid:

{% unless grid_item_width %}
  {% assign grid_item_width = 'large--one-quarter medium-down--one-half' %}
{% endunless %}

{% unless image_size %}
  {%- assign image_size = '600x600' -%}
{% endunless %}

{% unless current_collection %}
  {% assign current_collection = collection %}
{% endunless %}

{% assign on_sale = false %}
{% if product.compare_at_price > product.price %}
  {% assign on_sale = true %}
{% endif %}

{% assign sold_out = true %}
{% if product.available  %}
  {% assign sold_out = false %}
{% endif %}

<div class="grid-item {{ grid_item_width }}{% if sold_out %} sold-out{% endif %}{% if on_sale %} on-sale{% endif %}">

  <a href="{{ product.url | within: current_collection }}" class="product-grid-item">
    <div class="product-grid-image">
      <div class="product-grid-image--centered">
        {% if sold_out %}
          <div class="badge badge--sold-out"><span class="badge-label">{{ 'products.product.sold_out' | t }}</span></div>
        {% endif %}

        {% if product.featured_image %}
          {%- assign image = product.featured_image -%}
          {%- assign max_width = width | plus: 0 -%}
          {%- assign max_height = height | plus: 0 -%}

          {%- include 'image-logic' with width: max_width, height: max_height -%}

          {%- assign img_url = image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
        <div class="reveal">
          <div class="lazyload__image-wrapper no-js" style="max-width: {{ max_width }}px"> 
            
            <div style="padding-top:{{ 1 | divided_by: image.aspect_ratio | times: 100}}%;">
              
              <img
                class="lazyload no-js"
                data-src="{{ img_url }}"
                data-widths="[125, 180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 2048]"
                data-aspectratio="{{ image.aspect_ratio }}"
                data-sizes="auto"
                alt="{{ image.alt | escape }}"
                {% comment %}style="max-height: {{ height }}px;">{% endcomment %}>
              <img class="hidden" src="{{ product.images.last | img_url: '450x450' }}" alt="{{ product.images.last.alt | escape }}" />
            </div>
          </div>
        </div>
          <noscript>
           <img src="{{ image | img_url: '580x' }}"
             srcset="{{ image | img_url: '580x' }} 1x, {{ image | img_url: '580x', scale: 2 }} 2x"
             alt="{{ image.alt }}" style="opacity:1;">
         </noscript>

        {% else %}
        {% capture current %}{% cycle 1, 2, 3, 4 %}{% endcapture %}
        <div>
        {{ 'product-' | append: current | placeholder_svg_tag: 'placeholder-svg' }}
        </div>
      {% endif %}
      </div>
    </div>

    <p>{{ product.title }}</p>

    <div class="product-item--price">
      <span class="h1 medium--left">
        {% if on_sale %}
          <span class="visually-hidden">{{ "products.general.sale_price" | t }}</span>
        {% else %}
          <span class="visually-hidden">{{ "products.general.regular_price" | t }}</span>
        {% endif %}
        {% include 'price' with product.price %}
        {% if on_sale and section.settings.product_show_compare_at_price %}
          <small>
            <s>
              <span class="visually-hidden">{{ "products.general.regular_price" | t }}</span>
              {% include 'price' with product.compare_at_price %}
            </s>
          </small>
        {% endif %}
      </span>

      {% if on_sale and section.settings.product_show_saved_amount %}
        <span class="sale-tag{% unless section.settings.show_compare_at_price %} medium--right{% endunless %}{% if section.settings.product_reviews_enable %} has-reviews{% endif %}">
          {% assign compare_price = product.compare_at_price %}
          {% assign product_price = product.price %}
          {% include 'price-sale' %}
        </span>
      {% endif %}
    </div>

    {% if section.settings.product_reviews_enable %}
      <span class="shopify-product-reviews-badge" data-id="{{ product.id }}"></span>
    {% endif %}
  </a>

</div>

CSS code from theme.scss.liquid:

/* ===============================================
// 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; 
  }
}
0 Likes
Highlighted
Tourist
9 0 1

Ok, now the opacity is gone but all my products are covering the top bar after I hover on them like in the screen.
Capture.JPG

0 Likes
Highlighted
Shopify Partner
454 64 128

:) I was just looking at your site and thinking 'what opacity, I can't see any' thought I was going mad or blind.

If helpful then please Like and Accept Solution
0 Likes
Highlighted

Success.

Shopify Partner
454 64 128

That will be to do with the Z index you've set.

If helpful then please Like and Accept Solution
1 Like
Highlighted
Tourist
9 0 1

Lol, yeah sorry about that, my mistake,

I set Z index to 100 It's all good now, although I wonder why was in Shopify tutorial set to 100000.

Thanks anyway. :)

0 Likes
Highlighted
Shopify Partner
454 64 128

No problem. Glad you got it working as you want.

If helpful then please Like and Accept Solution
0 Likes