abstract:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>下滑线跟随导航作业</title> <script type="text/javascript" src="jquery-3.3.1.min.js"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>下滑线跟随导航作业</title>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<style type="text/css">
*{
margin: 0 auto;
padding: 0;
}
.menu {
padding: 0;
width: 100px;
height: 330px;
margin: 0 auto;
background: #600;
margin-top: 20px;
color: #ffc;
border-radius: 20px;
position: relative;
box-shadow: 0 5px 20px #f96;
}
ul{
list-style: none;
border-radius: 15px;
z-index:20;
position: relative;
}
li {
padding: 0;
width: 100px;
height: 35px;
line-height: 35px;
text-align: center;
cursor: pointer;
margin-top: 20px;
margin-bottom: 20px;
}
</style>
<script type="text/javascript">
$(function(){
$('li').hover(
function(){
$x=parseInt($(this).attr('name'))*50
$('.block').stop().animate({top:$x+'px'},300)
},
function(){
$('.block').stop().animate({top:'30px'},300)
}
)
})
</script>
</head>
<body>
<div class="menu">
<ul class="one">
<li name="1">首页</li>
<li name="2">关于我们</li>
<li name="3">业务体系</li>
<li name="4">新闻资讯</li>
<li name="5">人才招聘</li>
<li name="6">联系我们</li>
</ul>
<div class="block" style="z-index:10;width:100px;height:2px;background:#fff;position:absolute;top:30px;"></div>
</div>
</body>
</html>
Correcting teacher:天蓬老师Correction time:2019-01-13 10:47:42
Teacher's summary:在动画中, 也不仅是在动画中, 回调参数的使用非常广泛, 它可以解决阻塞问题,还能让代码更加的紧凑, 但是你的回调中, 建议给每一条语句加上分号, 并且写上注释