简体   繁体   English

将鼠标悬停在缩略图上并覆盖透明的放大镜图像

[英]Hover over thumbnail image and overlay with a transparent magnifier image

First of all, I'm using Volusion. 首先,我正在使用Volusion。 Here's a sample for a category page of my website: http://www.gtsimulators.com/Somso-Models-s/87.htm 这是我的网站类别页面的示例: http : //www.gtsimulators.com/Somso-Models-s/87.htm

So if you're familiar enough with Volusion, you will know that it is pretty limited for customization. 因此,如果您对Volusion足够熟悉,您将知道它在定制方面非常有限。 Here's the thing I'm having trouble to figure it out: 这是我很难弄清楚的事情:

I need to add a overlay image with a transparent magnifier when hover over the thumbnail image on categories (please check link above), so the visitor will know that clicking on the image will take an action. 将鼠标悬停在类别的缩略图上时,需要添加带有透明放大镜的叠加图像(请单击上面的检查链接),以便访问者知道单击该图像将执行操作。 I know it can be made with CSS only but I'm not sure which classes or ids to pull. 我知道只能用CSS制成,但是我不确定要拉哪个类或ID。

I know it looks like a question that have already been answered. 我知道这看起来像一个已经被回答的问题。 But since we're talking about Volusion specifically, it might help a lot of people using the same platform. 但是,由于我们是在专门讨论Volusion,因此它可能会帮助使用同一平台的许多人。

Here's a piece of the code for the HTML thumbnail: (it is auto-generated and I can't edit it) 这是HTML缩略图的一部分代码:(它是自动生成的,我无法对其进行编辑)

<div class="v-product">
<a href="http://www.gtsimulators.com/aging-simulation-suit-gert-p/ppd1002.htm" title='Aging Simulation Suit' class="v-product__img">
<img src="/v/vspfiles/photos/PPD1002-1.jpg" style="alt="Aging Simulation Suit"></a>
<a href="http://www.gtsimulators.com/aging-simulation-suit-gert-p/ppd1002.htm" class="v-product__title productnamecolor colors_productname" title="Aging Simulation Suit GERT, PPD1002"> 
Aging Simulation Suit GERT
</a>
</div>

I've already implemented opacity and a border on it. 我已经实现了不透明度和边框。 But I need an overlay image of a magnifier. 但是我需要一个放大镜的叠加图像。 If you can help me by answering with the exact structure of classes and ids from my website, would be perfect. 如果您可以通过回答我网站上类和id的确切结构来帮助我,那将是完美的。

Here's the piece of CSS I modified already: 这是我已经修改过的CSS:

.v-product__img 
{  display: inline-block;  min-height: 170px !important;  text-align: center;  vertical-align: middle;  width: 100%;
}
.v-product__img > img {
border:none !important;
} 
.v-product__img > img:hover {
border:3px solid #DDD !important;
border-radius:5px !important;
margin-top:-3px !important;
opacity:.75;
}

If you have any other suggestion of how to implement it, I would appreciate it. 如果您对如何实施有其他建议,我将不胜感激。

I will be glad to provide more information if needed. 如果需要,我将很高兴提供更多信息。

Please help. 请帮忙。 Thanks! 谢谢!

here's an example of a way to do it: https://jsfiddle.net/68j4u3s7/ 这是一种实现方法的示例: https : //jsfiddle.net/68j4u3s7/

The condition being that your magnifier image would be the background image. 条件是您的放大镜图像将是背景图像。 You could also reverse it, making the actual image the background image and the magnifier image the img src, change the opacity to the magnifier image CSS styles to hide it on load and show it on hover... but that option may be a bit odd. 您也可以反转它,将实际图像作为背景图像,将放大镜图像作为img src,将放大镜图像的不透明度更改为CSS样式以在加载时将其隐藏并在悬停时显示...但是该选项可能有点奇。

HTML HTML

<div id="your-image">
  <img src="http://placecage.com/g/200/300" alt="">
</div>

CSS CSS

#your-image {
  background-image: url('http://placecage.com/c/200/300');
  background-position: 0 0;
  background-repeat: no-repeat;
}

#your-image:hover img {
  opacity: 0.35;
}

All right. 好吧。 I was messing around and I found the answer with :after. 我在胡闹,发现:after的答案。 Here's the code I used for the desired effect: 这是我用来达到预期效果的代码:

.v-product__img:hover:after {content:""; position:absolute; margin:0 auto; width:90px; height:90px; border-radius:90px; top:15px; left:0; bottom:0; right:0; background-color: rgba(0,0,0,0.5); 
background-image: url('/v/vspfiles/templates/vws/images/buttons/product-magnifier.png');
background-repeat: no-repeat;
background-position: center; 
transition: all 0.5s;
-webkit-transition: all 0.5s;
opacity: 1;
}

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

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