我有一些CSS3悬停效果来动画图片标题:
.imageDetails {
width: 100%;
height: 360px;
position: absolute;
bottom: -100px;
opacity: 0;
color: white;
background-color: black;
}
.item:hover .imageDetails {
bottom: 0;
-webkit-transition: all 0.5s, -webkit-transform 0.5s;
transition: all 0.5s, transform 0.5s;
width:100%;
height: 330px;
opacity:1;
}
.readMoreLink {
color:#ACACAC;
opacity: 0;
text-align: center;
}
.item:hover .readMoreLink {
-webkit-transition-duration: 2s; /* Safari */
-webkit-transition-delay: 1s; /* Safari */
transition-duration: 2s;
transition-delay: 1s;
opacity: 1;
}
在hover
上它会有效,但鼠标输出只是清除。我也希望它能滑出来。
我尝试使用以下内容,但行为不端。
.item:hover .imageDetails:not( :hover ){
bottom: -100px;
-webkit-transition: all 0.5s, -webkit-transform 0.5s;
transition: all 0.5s, transform 0.5s;
width:100%;
height: 330px;
opacity:1;
}
我可以使用CSS添加幻灯片效果还是jQuery更适合这类事情?
答案 0 :(得分:2)
您还需要将过渡属性应用于非悬停类,如下所示:
.readMoreLink {
color:#ACACAC;
opacity: 0;
text-align: center;
-webkit-transition-duration: 2s; /* Safari */
-webkit-transition-delay: 1s; /* Safari */
transition-duration: 2s;
transition-delay: 1s;
}
.item:hover .readMoreLink {
-webkit-transition-duration: 2s; /* Safari */
-webkit-transition-delay: 1s; /* Safari */
transition-duration: 2s;
transition-delay: 1s;
opacity: 1;
}