你可以看到这里,在覆盖一堆图像时,我试图创建的动画。动画是正确的,但是:
我希望我能说清楚。
Jsfiddle:
$('figure').mouseenter(function() {
$(this).delay(0).queue(function(next) {
$(this).find('img:nth-child(1)').css({
'z-index': '1',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(2)').css({
'z-index': '1',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(3)').css({
'z-index': '1',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(4)').css({
'z-index': '1',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(5)').css({
'z-index': '1',
});
next();
});
// reverse it
$(this).delay(0).queue(function(next) {
$(this).find('img:nth-child(4)').css({
'z-index': '2',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(3)').css({
'z-index': '3',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(2)').css({
'z-index': '4',
});
next();
});
$(this).delay(300).queue(function(next) {
$(this).find('img:nth-child(1)').css({
'z-index': '5',
});
next();
});
});

figure {
width: 300px;
height: 300px;
float: left;
position: relative;
overflow: hidden;
text-align: center;
vertical-align: bottom;
display: block;
}
figure img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
filter: grayscale(100%);
margin: auto;
}
figure img:nth-child(1) {
width: 60%;
z-index: 5;
}
figure img:nth-child(2) {
width: 70%;
z-index: 4;
}
figure img:nth-child(3) {
width: 80%;
z-index: 3;
}
figure img:nth-child(4) {
width: 90%;
z-index: 2;
}
#main figure img:nth-child(5) {
width: 100%;
z-index: 1;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<figure>
<a>
<img src="https://fakeimg.pl/300/efefef/">
<img src="https://fakeimg.pl/300/c7c7c7/">
<img src="https://fakeimg.pl/300/9b9b9b/">
<img src="https://fakeimg.pl/300/ff0000/">
<img src="https://fakeimg.pl/300/2b2b2b/">
</a>
</figure>
&#13;
感谢您的帮助!