请问这个BUG是什么情况?谢谢
<!DOCTYPE html> <html> <head> <meta charset="GB2312"> <title>json</title> <style type="text/css"> * { margin: 0; padding: 0; } .lis { height: 260px; width: 260px; background-color: antiquewhite; border-radius: 60px; margin-top: 10px; line-height: 60px; text-align: center; border: 5px solid cadetblue; opacity: 0.5; box-shadow: 5px 2px 10px darkred; } </style> <script src="speed_flash/donghua.js"></script> <script type="text/javascript"> window.onload=function(){ var oli=document.getElementById("lis"); oli.onmouseover=function(){ lis_over(oli,10,0,{width:400,height:460}); } } </script> </head> <body> <ul id=oul> <li class="lis" id="lis">imooc</li> </ul> </body> </html>
function lis_over(obj, speed, lg, json, fn) { obj.timer = null; var sp = 10, flag = true; clearInterval(obj.timer); obj.timer = setInterval(function() { for (var sty in json) { //样式值处理 var wd = window.getComputedStyle(obj, null)[sty]; if (sty == 'opacity') { wd = Math.round(parseFloat(wd) * 100)/100; } else { wd = parseInt(wd); } //判断结束 if (wd != json[sty]) { flag = false; } if (flag) { clearInterval(obj.timer); if (fn) { fn(); } } //速度正负判断 if (lg != 0) { speed = -10; } //透明度 if (sty == 'opacity') { var a = wd*100 + speed; obj.style[sty] = a / 100; } else { obj.style[sty] = wd + speed + "px"; } } }, 100) }
谢谢!我是希望能够同时运动,然后等大家运动到达目的地才结束!