<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="js/jquery-3.4.0.min.js" type="text/javascript"></script>
<style type="text/css">
*{ padding:0px; margin:0px;}
ul{ list-style:none; z-index:20; position:relative; font-size:20px;}
li{ float:left; cursor:pointer; margin:20px ; height:32px; box-shadow:0 2px 20px #000000; background-color:#af3434; border-radius:3px}
</style>
</head>
<body>
<script type="text/javascript">
//放入javascript代码或者jQuery代码
//文档就绪函数
$(document).ready(function(e) {
$("li").hover(function(){
$x = parseInt($(this).attr("name"))*100;
$(".block").stop().animate({left:$x+"px"},300);
},function(){
$(".block").stop().animate({left:"0px"},300);
}
);
});
</script>
<div class="munu">
<ul>
<li name= "0">首页</li>
<li name= "1">第二页</li>
<li name= "2">第三页</li>
<li name= "3">第四页</li>
<li name= "4">第五页</li>
</ul>
<div class="block" style=" position:absolute; z-index:10; width:100px; height:4px; background:blue; top:50px;" ></div>
</div>
</body>
</html>