首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当悬停时,如何在图像上添加一层多重混合模式?

当悬停时,如何在图像上添加一层多重混合模式?
EN

Stack Overflow用户
提问于 2016-10-03 01:21:28
回答 1查看 1.5K关注 0票数 1

当悬停时,我想要这样的东西:从第一个图像到第二个图像。其效果是:灰度模糊原始图像+顶部多层。

现在,我正在用另一个图像技巧来做这件事,但这不方便。到目前为止,这是我的代码:

代码语言:javascript
复制
.imgwrapper {
  position: relative;
}
.showtext + div {
  position: absolute;
  left: 113px;
  top: 113px;
color: white; 
 text-decoration:underline;
  display: none;
  pointer-events: none;
  font-size: 18px;
  width: 250px;
  letter-spacing: 4px;
}
.showtext:hover + div {
  display: block;
}
代码语言:javascript
复制
<a href="single-illustration-sidebar-left.html" class="permalink">
					<div class="desktop-3 mobile-half columns">
						<div class="item">
							<h3>Plython album</h3>
							<span class="category">identity</span>

							<div class="imgwrapper">
							<img  class="showtext" src="images/thumb_item08.png" onmouseover="this.src='images/thumb_item08a.png';" onmouseout="this.src='images/thumb_item08.png';" />
							<div id="view">view</div></div>
						</div><!-- // .item -->
					</div><!-- // .desktop-3 -->
				</a>

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-03 11:01:10

我希望你能发现这段代码有帮助。

工频

您需要添加一个容器到您的图像,并触发悬停在它上。

代码语言:javascript
复制
.img-con {
  width: 250px;
  padding: 5%;
  background: rgba(209, 19, 15, 0);
  transition: ease .1s;
  -webkit-transition: ease .1s;
  -moz-transition: ease .1s;
  -ms-transition: ease .1s;
  -o-transition: ease .1s;
}
.img-con > img {
  position: relative;
  width: 100%;
  transition: ease .1s;
  -webkit-transition: ease .1s;
  -moz-transition: ease .1s;
  -ms-transition: ease .1s;
  -o-transition: ease .1s;
}
.img-con:hover {
  background: rgba(209, 19, 15, 0.75);
}
.img-con:hover > img {
  z-index: -1;
  -webkit-filter: grayscale(100%) blur(2px) contrast(200%);
  filter: grayscale(100%) blur(2px) contrast(200%);
}
代码语言:javascript
复制
<div class="img-con">
  <img src="http://i.stack.imgur.com/zzzFU.png" />
</div>

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39823378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档