Связанный пример интернет-магазина не работает для меня в Firefox, потому что темный полупрозрачный оверлейный div находится перед ссылкой.Когда я скрываю оверлей, он работает для меня (изменение указателя мыши).
Подтверждение концепции со встроенным стилем (только для демонстрации).Я спрятал div с помощью display:none;
<div class="block2">
<div class="block2-img wrap-pic-w of-hidden pos-relative ">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail">
<img class="" src="//cdn.shopify.com/s/files/1/2672/5778/products/item-03_1200x1600.jpg?v=1514269273" alt="Boxy T-Shirt with Roll Sleeve Detail">
</a>
<div class="block2-overlay trans-0-4" style="display: none;">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail" class="block2-btn-addwishlist hov-pointer trans-0-4">
<!-- <i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i> -->
</a>
<div class="block2-btn-addcart w-size1 trans-0-4">
<!-- Button -->
<button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4" data-toggle="tooltip" data-loading-text="Loading..." title="" onclick="cart.add('8250556252202', 'Boxy T-Shirt with Roll Sleeve Detail');" data-original-title="Add to Cart">
Add to Cart
</button>
</div>
</div>
</div>
<div class="block2-txt p-t-20">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail" class="block2-name dis-block s-text3 p-b-5">
Boxy T-Shirt with Roll Sleeve Detail
</a>
<span class="block2-price m-text6 p-r-5">
<span class="money" data-currency-usd="$20.00">$20.00</span>
</span>
</div>
</div>
. Пожалуйста, используйте отладчик веб-браузера, чтобы проверить, есть ли в вашем примере оверлей.Если да, то это объясняет, почему работает фрагмент кода, потому что в этом фрагменте нет CSS.
Изменить, чтобы ответить на комментарий:
Также оборачиваем div с тегом привязки, не работает для меня (может быть, недействительный HTML?).Вы можете добавить ссылку на div: добавить событие через JavaScript или грязный хак в следующем примере кода: onclick="location.href='/products/boxy-t-shirt-with-roll-sleeve-detail'"
на элементе hover и фальшивый указатель мыши с помощью css.
<div class="block2-img wrap-pic-w of-hidden pos-relative ">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail">
<img class="" src="//cdn.shopify.com/s/files/1/2672/5778/products/item-03_1200x1600.jpg?v=1514269273" alt="Boxy T-Shirt with Roll Sleeve Detail">
</a>
<div class="block2-overlay trans-0-4" onclick="location.href='/products/boxy-t-shirt-with-roll-sleeve-detail'" >
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail" class="block2-btn-addwishlist hov-pointer trans-0-4">
<!-- <i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i> -->
</a>
<div class="block2-btn-addcart w-size1 trans-0-4">
<!-- Button -->
<button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4" data-toggle="tooltip" data-loading-text="Loading..." title="" onclick="cart.add('8250556252202', 'Boxy T-Shirt with Roll Sleeve Detail');" data-original-title="Add to Cart">
Add to Cart
</button>
</div>
</div>
</div>
main.cssв строке 1739:
/* ------------------------------------ */
.block2-overlay:hover {
opacity: 1;
cursor: pointer;
}
Редактировать: Ответ на следующий комментарий на 2018-05-30:
Убедитесь, что кнопка добавления в корзину находится перед парениемпанель.Стоп событие пузырится.
<div class="block2">
<div class="block2-img wrap-pic-w of-hidden pos-relative ">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail">
<img class="" src="//cdn.shopify.com/s/files/1/2672/5778/products/item-03_1200x1600.jpg?v=1514269273" alt="Boxy T-Shirt with Roll Sleeve Detail">
</a>
<div class="block2-overlay trans-0-4" onclick="location.href='https://fashe-theme.myshopify.com/products/boxy-t-shirt-with-roll-sleeve-detail'">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail" class="block2-btn-addwishlist hov-pointer trans-0-4">
<!-- <i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
<i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i> -->
</a>
<div class="block2-btn-addcart w-size1 trans-0-4">
<!-- Button -->
<button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4" data-toggle="tooltip" data-loading-text="Loading..." title="" onclick="cart.add('8250556252202', 'Boxy T-Shirt with Roll Sleeve Detail');event.stopPropagation();" data-original-title="Add to Cart">
Add to Cart
</button>
</div>
</div>
</div>
<div class="block2-txt p-t-20">
<a href="/products/boxy-t-shirt-with-roll-sleeve-detail" class="block2-name dis-block s-text3 p-b-5">
Boxy T-Shirt with Roll Sleeve Detail
</a>
<span class="block2-price m-text6 p-r-5">
<span class="money" data-currency-usd="$20.00">$20.00</span>
</span>
</div>
</div>
Это означает: мы должны добавить event.stopPropagation();
в onclick
кнопки.