gpt4 book ai didi

CSS悬停停止动画

转载 作者:行者123 更新时间:2023-11-28 10:19:39 32 4
gpt4 key购买 nike

我有一个 <span>里面有一些文字,当你将鼠标悬停在它上面时,一个图像会从页面上滑下来。到目前为止,一切都很好。但是,当您的鼠标不小心悬停在图像上时,动画将会停止。我不要那个。

.coffee {
-webkit-transition: color 0.2s linear;
-moz-transition: color 0.2s linear;
-o-transition: color 0.2s linear;
-ms-transition: color 0.2s linear;
transition: color 0.2s linear;
z-index: 10;
}
.coffee:hover {
color: #B88A00;
}
.coffee img {
position: absolute;
display: block;
height: 100px;
width: 100px;
z-index: 1;
left: 280px;
top: 50px;
opacity: 0;
-webkit-transition: top 0.4s ease-in-out, opacity 0.6s ease-in-out;
-moz-transition: top 0.4s ease-in-out, opacity 0.6s ease-in-out;
-o-transition: top 0.4s ease-in-out, opacity 0.6s ease-in-out;
-ms-transition: top 0.4s ease-in-out, opacity 0.6s ease-in-out;
transition: top 0.4s ease-in-out, opacity 0.6s ease-in-out;
}
.coffee:hover img {
top: 150px;
opacity: 1;
}

如有任何帮助,我们将不胜感激。

最佳答案

据我了解,这可能就是您想要的。像这样写:

HTML

<span class="coffee"><u>coffee</u></span>!
<img src="image.jpg" alt="Coffee!"/>

CSS

.coffee:hover + img{
top: 150px;
opacity: 1;
}

检查这个http://jsfiddle.net/quLKb/2/

关于CSS悬停停止动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12510761/

32 4 0
文章推荐: javascript - ASP.NET:HtmlGenericControl
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com