我想使用JavaScript创建动画。使用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()但我不知道如何!
你正在所有的画面消失,更好的办法是使用'fadeIn'与'fadeOut'一起使它们可见。 – 2013-05-13 08:51:25