Jquery 淡入淡出

<html>
<head>
<script type="text/javascript" src="jquery.js"> </script>

<script type="text/javascript"> function countDown(secs){ var $jumpTo =$("#jumpTo"); $jumpTo.text(secs); if(--secs>0){ $("#div1").fadeOut(3000); $("#div2").fadeIn(3000); setTimeout("countDown("+secs+")",1000); } else{ $("#div1").fadeIn(3000); $("#div2").fadeOut(3000); setTimeout("countDown("+2+")",1000); } } </script>
</head>
<body onload="countDown(3);">
  <div id="div1" style="height:10%;width=10%;background-color: red;display: none;">test</div>
<div id="div2" style="height:10%;width=10%;background-color: yellow;">test2</div>
<span id="jumpTo" style="display: none;">2</span>
</body>
</html>

你可能感兴趣的:(Jquery 淡入淡出)