[url]http://my.oschina.net/HeYuhui/blog/632467[/url]
function change2(){
document.getElementById("img2").style.zIndex='2';
document.getElementById("img1").style.zIndex='1';
document.getElementById("img1").style.opacity='1';
$("#img2").animate({opacity:'0'},2000);
}
function change3(){
document.getElementById("img1").style.zIndex='2';
document.getElementById("img2").style.zIndex='1';
$("#img1").animate({opacity:'0'},2000);
document.getElementById("img2").style.opacity='1';
}
function change4(){
setTimeout("change2()",5000);
setTimeout("change3()",12000);
setTimeout("change4()",14000);
}
本文介绍了一种使用JavaScript实现的网页图片切换效果。通过修改图片的z-index和透明度,实现了两张图片之间的平滑过渡。利用setTimeout函数控制动画的定时触发,达到循环播放的效果。
296

被折叠的 条评论
为什么被折叠?



