【发布时间】:2015-04-06 20:13:34
【问题描述】:
昨天我在将鼠标悬停在另一个链接上时让图像淡入时得到了一些帮助,但我很难弄清楚如何让它淡出。这可能涉及java?我很抱歉,因为我对更高级的编码(过去基本的 CSS/HTML)很陌生。
这是昨天有人给我的,它很好地淡入淡出,但是一旦你从链接中移开鼠标,我希望它淡出。
img { opacity: 0; }
a:hover +img {
-webkit-animation: changeOpacity 5s;
animation: changeOpacity 5s;
}
@-webkit-keyframes changeOpacity {
0% { opacity: 0; }
100% { opacity: 1; }
}
/* Standard syntax */
@keyframes changeOpacity {
0% { opacity: 0; }
100% { opacity: 1; }
}
这是 HTML:
<a href="http://lorempixel.com/300/300/sports/1">
Hover the see Full image,click to go there
</a>
<img src="http://lorempixel.com/300/300/sports/1" width="200" height="200" />
<br>
<a href="http://lorempixel.com/300/300/sports/1">
Hover the see Full image,click to go there
</a>
<img src="http://lorempixel.com/300/300/sports/1" width="200" height="200" />
任何帮助将不胜感激!
【问题讨论】:
标签: javascript jquery html css animation