我有一个简单的问题要问你。为什么下面的代码无法正常工作 - 图像无法消失。怎么了?我必须在 jQuery 中使用 fadeOut 函数。也许这是一个语法错误?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>FadeOut - jQuery</title>
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
<style type="text/css">
#outercorners img {
display:yes;
}
</style>
<script type="text/javascript">
var x=1; // The corner counter
function fading() {
$("#corner"+(++x)).fadeOut(2000); // Fade in the current corner
if (x==5) { // Last image to be faded in?
clearInterval(); // Stop interval
}
}
$(document).ready(function(){
$("button").click(function(){
setInterval("fading()",1000); // Call function every second
});
</script>
</head>
<body>
<button>Start!</button>
<div id="outercorners">
<img id="corner1" src="images/mouse_1.jpg" width="200" height="150"/>
<img id="corner2" src="images/mouse_2.jpg" width="200" height="150"/>
<img id="corner3" src="images/mouse_3.jpg" width="200" height="150"/>
<img id="corner4" src="images/mouse_4.jpg" width="200" height="150"/>
<div id="corner5"><img src="images/mouse_5.jpg" width="200" height="150" />
<img id="corner6" src="images/mouse_6.jpg" width="200" height="150"/>
<img id="corner6" src="images/mouse_7.jpg" width="200" height="150"/>
<img id="corner7" src="images/mouse_8.jpg" width="200" height="150"/>
<div id="corner9"><img src="images/mouse_9.jpg" width="200" height="150" />
<img id="corner10" src="images/mouse_10.jpg" width="200" height="150"/>
<img id="corner11" src="images/mouse_11.jpg" width="200" height="150"/>
<img id="corner12" src="images/mouse_12.jpg" width="200" height="150"/>
<div id="corner13"><img src="images/mouse_13.jpg" width="200" height="150" />
<img id="corner14" src="images/mouse_14.jpg" width="200" height="150"/>
<img id="corner15" src="images/mouse_15.jpg" width="200" height="150"/>
<img id="corner16" src="images/mouse_16.jpg" width="200" height="150"/>
</div>
</div>
</body>
</html>
谢谢!