没分了,求解析一个很少见的现象
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
#div1{width:0px; height:0px; background:#CCC; position:absolute; left:0px; top:0px;}
#div2{width:0px; height:0px; background:#000; position:absolute; left:500px; top:300px;}
#div3{width:0px; height:0px; background:#FF0; position:absolute; left:0px; top:0px;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="jquery-1.3.2.min.js"></script>
<script>
$(function(){
var j=1;
var oDiv1=document.getElementById('div1')
var oDiv2=document.getElementById('div2')
var oDiv3=document.getElementById('div3')
setInterval(function(){
if(j==6)
{
j=1
}
else
{
j++
}
if(j==1)
{
$('#div1').animate({height:300,width:500},2500,function(){
$('#div1').animate({height:0,width:0,left:500,top:300},3500)
})
}
else if(j==2)
{
$('#div2').animate({height:300,width:500,left:0,top:0},2500,function(){
$('#div2').animate({height:0,width:0,left:0,top:0},3500)
})
}
else if(j==3)
{
$('#div3').animate({height:300,width:500,left:0,top:0},2500,function(){
$('#div3').animate({height:0,width:0,left:500,top:300},3500)
})
}
else if(j==4)
{
$('#div1').animate({height:300,width:500,left:0,top:0},2500,function(){
$('#div1').animate({height:0,width:0,left:0,top:0},3500)
})
}
else if(j==5)
{
$('#div2').animate({height:300,width:500,left:0,top:0},2500,function(){
$('#div2').animate({height:0,width:0,left:500,top:300},3500)
})
}
else if(j==6)
{
$('#div3').animate({height:300,width:500,left:0,top:0},2500,function(){
$('#div3').animate({height:0,width:0,left:0,top:0},3500)
})
}
},6000)
$('#div1').animate({height:300,width:500},2500,function(){
$('#div1').animate({height:0,width:0,left:500,top:300},3500)
})
})
</script>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</body>
</html>
为什么我把游览器隐藏到工具栏,等一会,再查看页面运行的效果,会出现两个Div同时执行的现象(感觉上是一个定时器没有关闭,一个定时器又开了,如果不隐藏到工具栏就没有这个问题),我也不知道这样描述对不对,自己实验一下就发现问题了。求解产生这个问题的原因,怎么解决?(IE8和谷歌都出现这个问题,其他游览器没试)