【发布时间】:2015-05-22 01:49:47
【问题描述】:
对于一个艺术家的网站,图片完全填满浏览器窗口,我想显示一条缩略图,它将消失,只留下当前图像的缩略图在角落里。当您将鼠标移到此缩略图上时,缩略图条应会再次出现,以便您可以选择新图片。
我在下面包含了这个效果的模型,以及一个jsFiddle,您可以在其中看到这个效果。
如果您将鼠标移到缩略图上然后再次快速关闭,动画将停止,保持暂停状态 1 秒钟,然后反转。我应该如何更改 CSS 以便滑出动画在开始后始终播放到结尾?
<html>
<head>
<style>
html, body {
height: 100%;
margin:0;
overflow: hidden;
}
div {
position:absolute;
left:0;
width: 100px
}
#cue, #thumb {
bottom:0;
height:50px;
}
#cue, #thumb {
bottom:0;
height:50px;
}
#cue {
background: none;
opacity: 0.2;
z-index: 2;
}
#thumb {
background: blue;
opacity: 0.5;
}
#strip {
background: blue;
opacity: 0.2;
z-index:1;
height: 99%;
top: 100%;
-webkit-transition: all 500ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-moz-transition: all 500ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-o-transition: all 500ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
transition: all 500ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-webkit-transition-delay: 1s;
transition-delay: 1s;
}
#cue:hover + #strip, #strip:hover {
top: 1%;
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
#thumb {
-webkit-transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-moz-transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-o-transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
transition: all 300ms cubic-bezier(0.420, 0.000, 0.580, 1.000);
-webkit-transition-delay: 1200ms;
transition-delay: 1200ms;
}
#cue:hover ~ #thumb, #strip:hover+#thumb {
opacity: 0;
-webkit-transition-delay: 0s;
transition-delay: 0s;
}
</style>
</head>
<div id="cue"></div>
<div id="strip"></div>
<div id="thumb"></div>
</html>
【问题讨论】:
标签: css animation css-animations timing