首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >延迟悬停效果-防止关闭重叠

延迟悬停效果-防止关闭重叠
EN

Stack Overflow用户
提问于 2021-01-24 15:56:22
回答 1查看 37关注 0票数 1

我创建了一个悬停效果,模糊了一张图片,然后出现了一个文本描述。

现在,只要我在描述上悬停,我就不会悬停图像,效果就会失败,这是我想要防止的。

我假设,如果我可以针对悬停版本的描述,我可以使其自身设置为可见,但我不确定这一点。

有什么其他的想法可以让我创建这个吗?

代码语言:javascript
运行
复制
.flexbox{
position: relative;
display: flex;
height: 70vh;
flex-direction: row;
width: 90%;
margin-left: 5%;
max-height: 80vh;

}

.container{
  width: 100%;
  max-height: inherit;
  padding: 0;
  margin: 1%;
  display:block;
  text-align: center;
}

.image-category{
  width: 100%;
  object-fit: cover;
  height: 100%;
  opacity: 0.95;
  max-height: inherit;
  overflow: hidden;
}

.image-description{
padding: 10px;
transform: translateY(-30vh);
opacity: 0;
z-index: -1;
font-size: 20px;
}

.image-category:hover{
  filter: blur(2px);
}

.image-category:hover ~ .image-description{
  opacity: 100;
  z-index: 2;
}

.description{
font-size: 1.25em;
background: rgba(255, 255, 255, 0.7);
}

.claim{

padding: 1vh 0 1vh 0;
width: 100%;
text-align: center;
}
代码语言:javascript
运行
复制
Delay Hover
    <div class="flexbox" id="flex">

      <div class="container" id="box1">
        <a class="image-category" href="https://amh-solingen.de/scheren.html">
        <img class="image-category" id="product3" src="/images/Schere.jpg">
        </a>
        <div class="image-description">
          <p class="description">Haushalts- und Friseurscheren</p>
        </div>
      </div>

      <div class="container" id="box2">
        <a class="image-category" href="https://amh-solingen.de/haushaltsmesser.html">
        <img class="image-category" id="product2" src="/images/Hero.png">
        </a>
        <div class="image-description">
          <p class="description">Aktuelle Auswahl an Küchenmessern</p>
        </div>
      </div>

      <div class="container" id="box3">
        <a class="image-category" href="https://amh-solingen.de/klingen.html">
        <img class="image-category" id="product3" src="/images/Klinge_7.jpg">
        </a>
        <div class="image-description">
          <p class="description">Klingen für Haushaltsmesser</p>
        </div>

      </div>
    </div>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-24 16:30:51

使用以下代码:

代码语言:javascript
运行
复制
.flexbox{
position: relative;
display: flex;
height: 70vh;
flex-direction: row;
width: 90%;
margin-left: 5%;
max-height: 80vh;

}

.container{
  width: 100%;
  max-height: inherit;
  padding: 0;
  margin: 1%;
  display:block;
  text-align: center;
}

.image-category{
  width: 100%;
  object-fit: cover;
  height: 100%;
  opacity: 0.95;
  max-height: inherit;
  overflow: hidden;
}

.image-description{
padding: 10px;
transform: translateY(-30vh);
opacity: 0;
z-index: -1;
font-size: 20px;
}

.container:hover .image-category{
  filter: blur(2px);
}

.container:hover .image-description{
  opacity: 100;
  z-index: 2;
}

.description{
font-size: 1.25em;
background: rgba(255, 255, 255, 0.7);
}

.claim{

padding: 1vh 0 1vh 0;
width: 100%;
text-align: center;
}
代码语言:javascript
运行
复制
Delay Hover
    <div class="flexbox" id="flex">

      <div class="container" id="box1">
        <a class="image-category" href="https://amh-solingen.de/scheren.html">
        <img class="image-category" id="product3" src="/images/Schere.jpg">
        </a>
        <div class="image-description">
          <p class="description">Haushalts- und Friseurscheren</p>
        </div>
      </div>

      <div class="container" id="box2">
        <a class="image-category" href="https://amh-solingen.de/haushaltsmesser.html">
        <img class="image-category" id="product2" src="/images/Hero.png">
        </a>
        <div class="image-description">
          <p class="description">Aktuelle Auswahl an Küchenmessern</p>
        </div>
      </div>

      <div class="container" id="box3">
        <a class="image-category" href="https://amh-solingen.de/klingen.html">
        <img class="image-category" id="product3" src="/images/Klinge_7.jpg">
        </a>
        <div class="image-description">
          <p class="description">Klingen für Haushaltsmesser</p>
        </div>

      </div>
    </div>

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

https://stackoverflow.com/questions/65868252

复制
相关文章

相似问题

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