//键盘 var y=0; oBox.children[0].addEventListener('transitionend',function(){ change(y); },false); var iSpeedY=0; var lastY=0; var timer=null; document.onmousedown=function(ev){ clearInterval(timer); for(var i=0; i<oBox.children.length; i++){ oBox.children[i].style.transition='none'; } var disX=ev.clientX-y; document.onmousemove=function(ev){ y=ev.clientX-disX; change(y/10); iSpeedY=y-lastY; lastY=y; }; document.onmouseup=function(){ document.onmousemove=null; document.onmouseup=null; timer=setInterval(function(){ iSpeedY*=0.95; y+=iSpeedY; change(y/10); },30); }; return false; };