![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b6f732889f6434517c6d089cc08c2944.jpeg)
上代码
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
img{
display: block;
}
ul,ol{
list-style: none;
}
.box{
width: 650px;
height: 300px;
margin: 100px auto;
border: 1px solid #ccc;
position: relative;
/*padding: 5px;*/
overflow: hidden;
}
.box ol {
position: absolute;
left: 50%;
margin-left: -80px;
bottom: 10px;
}
.box .lb ul{
width: 1000%;
position: absolute;
}
.box .lb ul li{
float: left;
}
.box ol li{
float: left;
width: 18px;
height: 18px;
background-color: #fff;
margin-right: 10px;
text-align: center;
line-height: 18px;
cursor: pointer;
}
.box ol li.current{
background-color: orange;
}
</style>
<script>
window.function(){
var box=document.getElementById("box");
var ul=box.children[0].children[0];
var ol=box.children[1];
var ollis=ol.children;
var leader= 0,target=0;
for(var i=0;i<ollis.length;i++){
ollis[i].index=i;
ollis[i].onmouseover=function(){
for(var j=0;j<ollis.length;j++){
ollis[j].className="";
}
this.className="current";
target=-this.index*650;
}
}
setInterval(function(){
leader=leader+(target-leader)/10;
ul.style.left=leader+"px";
},30)
}
</script>
</head>
<body>
<div class="box" id="box">
<div class="lb">
<ul>
<li><img src="../images/mi01.jpg" alt=""/></li>
<li><img src="../images/mi02.jpg" alt=""/></li>
<li><img src="../images/mi03.jpg" alt=""/></li>
<li><img src="../images/mi04.jpg" alt=""/></li>
</ul>
</div>
<ol>
<li class="current">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ol>
</div>
</body>
</html>