简体   繁体   English

如何使这种悬停效果起作用?

[英]How can I make this hover effect to work?

I have this site: link . 我有这个网站: link If you put arrows on a product you'll notice that there is an orange hover. 如果在产品上放箭头,您会注意到有一个橙色的悬停。 I want this effect to occur the whole time arrow is on the product (currently only appears when the image). 我希望这种效果在整个产品上始终出现箭头(当前仅在图像上出现)。 Here's an image to understand better: 这是一张更好理解的图像:

在此处输入图片说明

.products-grid li.item .product-image:hover:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    background: url("http://www.altradona.ro/media/wysiwyg/OVERLAY.png");
}
<ul class="products-grid one_column_4">
    <li class="item">
        <div class="regular">
            <!-- some code HTML -->
        </div>
        <div class="hover">
            <!-- some code HTML -->
        </div>
    </li>
    <li class="item"></li>
    <li class="item"></li>
    <!-- etc -->
</ul>

I tried to use this jQuery code to solve the problem but it's not working: 我试图使用此jQuery代码来解决问题,但无法正常工作:

$(".item").hover(function() {
    $(.products-grid li.item .product-image:hover:after).css("background-image", "http://www.altradona.ro/media/wysiwyg/OVERLAY.png");
}
});

Can you tell me please what is wrong and how can I solve this problem? 您能告诉我什么地方出了问题,我该如何解决呢? Thanks in advance! 提前致谢!

用作CSS规则:

.products-grid li.item:hover .product-image:after { ... }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM