图片切换(非轮播,淡入淡出)
1.切换2.停止
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style type="text/css">
div{ position: absolute; left: 0px; top: 0px;}
.div1{ width: 800px; height: 400px; background-color: #ff3366;display: none}
.div2{ width: 800px; height: 400px; background-color: #33ff66;}a{ position: absolute; right: 0px;}
</style>
<script type="text/javascript" src="scripts/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
});
var c = setTimeout("show1()",1000);function show1(){
console.log(Math.random());
$(".div1").fadeIn(1000);
$(".div2").fadeOut(1000);
c = setTimeout("show2()",2000)
}function show2(){
console.log("may i " + Math.random());
$(".div1").fadeOut(1000);
$(".div2").fadeIn(1000);
c = setTimeout("show1()",1000)
}function clearTimer(){
alert("clearTimer");
clearTimeout(c)
}</script>
</head><body>
<div class="div1"></div>
<div class="div2"></div><a href="#" onclick="clearTimer()">aaaaa</a>
</body>
</html>
图片切换(非轮播,淡入淡出)--变形金刚joy007 项目总结