61,112
社区成员
发帖
与我相关
我的任务
分享
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 页面名称 </title>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<style type="text/css">
.vt {
position: relative;
height: 40px;
}
.vt ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.vt li {
float: left;
padding: 5px;
font-size: 20px;
}
.vt div {
clear: both;
position: relative;
height: 4px;
width: 0;
left: 0;
background-color: #f00;
transition: all cubic-bezier(0,0,1,1.5) 200ms;
}
</style>
</head>
<body>
<div class="vt">
<ul>
<li>AAAAAAA</li>
<li>BBBB</li>
<li>CCCCCCCCC</li>
<li>DDD</li>
</ul>
<div></div>
</div>
<script type="text/javascript">
$(".vt li").mouseenter(function(event){
$(this).parent().next().css({left:this.offsetLeft,width:this.offsetWidth});
}).mouseleave(function(event){
$(this).parent().next().css({left:0,width:0});
});
</script>
</body>
</html>