<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS同时运动</title>
<style type="text/css">
*{margin: 0;padding: 0}
ul,li{
list-style: none;
}
ul li{
width: 200px;
height: 100px;
background: yellow;
border: 4px solid #000;
filter: alpha(opacity:30);
opacity: 0.3;
}
</style>
<script src="move.js"></script>
<script type="text/javascript">
window.onload=function(){
var oLi = document.getElementById('li1');
oLi.onmouseover=function(){
//startMove(oLi,'width',400);
//startMove(oLi,'height',200);只能执行一个变化,因为当新开始执行一个StartMove的时候会清除前面执行的StartMove的定时器,存在覆盖问题,不能实现同时运动的效果
startMove(oLi,{width:201,height:200,opacity:100});
};
oLi.onmouseout=function(){
startMove(oLi,{width:200,height:100,opacity:30});
};
};
</script>
</head>
<body>
<ul>
<li id="li1"></li>
</ul>
</body>
</html>
打开App,阅读手记