做了个窗口抖动的效果,但是新打开的窗口抖动效果有了,可是怎么清除效果,以及清除效果后怎么关闭不知道怎么写...
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>窗口抖动</title>
</head>
<body>
<script>
var w=window.open('','', 'width=100,height=100');
w.resizeTo(300,300);
var loop;
var timer;
var offX;
var offY;
var status = 1;
timer = setInterval(function(){
w.moveTo(100,100);
if(loop<10){
clearInterval(timer);
}
status = Math.random()*10 > 5 ? 1 : -1;
offX = Math.random()*20*status;
offY = Math.random()*20*status*-1;
w.moveBy(offX,offY);
loop++;
},10);
</script>
</body>
</html>