为什么我的moveout函数没有实现呢
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>js动画框架1</title>
<style type="text/css">
span {}
.big {
height: 100px;
width: 200px;
background-color: red;
position: absolute;
left: -200px;
}
.share {
height: 50px;
width: 20px;
background-color: deepskyblue;
margin-left: 200px;
display: block;
font-family: "微软雅黑";
padding: 5px;
}
</style>
</head>
<body>
<div class="big" id="big"><span class="share">分享</span></div>
<script type="text/javascript">
window.onload = function() {
var mdiv = document.getElementById("big");
mdiv.onmouseover = function() {
startmove(mdiv,0);
}
mdiv.onmouseout = function() {
startmove(mdiv,-100);
}
}
var timer = null;
function startmove(div,its) {
clearInterval(timer);
// var mdiv = document.getElementById(div);
timer = setInterval(function() {
var speed = 0;
if (div.OffsetLeft > its) {
speed = -10;
} else {
speed = 10;
}
if (div.offsetLeft == its) {
clearInterval(timer);
} else {
div.style.left = div.offsetLeft + speed + 'px';
}
}, 30)
}
</script>
</body>
</html>