哪里不对啊,离开缩不回去了好奇怪
window.onload=function(){
odiv=document.getElementById("div1");
odiv.onmouseover=function(){
//move(10,0);
move(0);
}
odiv.onmouseout=function(){
//out();
//move(-10,-200);
move(-200);
}
}
var timer=null;
function move(target){
clearInterval(timer);
odiv=document.getElementById("div1");
timer = setInterval(function(){
var speed=0;
if(odiv.offsetLeft>target){
speed = -10;
}else{
speed=10;
}
if(odiv.offsetLeft>=target){
clearInterval(timer);
}else{
odiv.style.left =odiv.offsetLeft + speed+"px"; //变大
}
},500);
}