我想使用 JavaScript 创建动画。
图片应该重复(循环),问题是当脚本到达最终图片时有一个空白空间。
我想要的是: pic1 > pic2 > pic3 > pic4 > pic5 > pic1 > ...
编码:
<style type="text/css">
img {
position: absolute;
center: 0px;
top: 0px;
}
#img3 { z-index: 3; }
#img2 { z-index: 2; }
#img1 { z-index: 1; }
</style>
<img style="top: 0px; height: 199px;" src="img1.jpg" id="img1">
<img img2.jpg" id="img2"><img src="img3.jpg" id="img3">
<script src="http://code.jquery.com/jquery.js"></script>
<script>
$(function() {
$('img').first().fadeOut(2000, function suivante() {
$(this).next('img').fadeOut(2000,suivante);
});
});
</script>
我发现我应该使用函数 bis() 但我不知道如何!