<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://code.jquery.com/jquery-3.1.1.js"></script>
<!-- 제이쿼리 라이브러리 3.1.1버젼을 연결 -->
<script src="http://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<!-- 제이쿼리 ui파일로 background-color에 animate를 걸어주거나 draggable실행, 캘린더 ui 등 다양한 내용을 추가적으로 지정할 수 있는 플러그인 -->
<script src="./jquery.transform2d.js"></script>
<!-- animate에 transform 속성을 추가해 줄 수 있는 플러그인 -->
<script src="./jquery.easing.1.3.js"></script>
<!-- animate에 timing function을 보다 다양하게 지정할 수 있는 플러그인 -->
<style>
*{margin:0;padding:0;}
ul,li{list-style:none;}
a{text-decoration:none; color:#333;}
#menu{
width:960px;
height:60px;
margin:50px auto;
}
#menu ul{
width:100%;
height:100%;
position:relative;
}
#menu ul li{
float:left;
width:11.11%;
height:100%;
text-align:center;
line-height:60px;
position:relative;
z-index:1;
}
#menu ul li a{
display:block;
width:100%;
height:100%;
}
#menu ul .stroke{
width:11.11%;
height:60px;
border:5px solid red;
border-radius:5px;
box-sizing:border-box;
position:absolute;
left:0;
top:0;
}
</style>
<script>
$(function(){
$("#menu ul li").mouseover(function(){
var w = $("#menu ul li").width();
var i = $(this).index();
$(".stroke").stop().animate({ stop : 애니메이트 시작되기전에 그전에 적용된애들 다 꺼버리긔~!
"left":w*i
});
//alert(i);
});
});
</script>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#">메일</a></li>
<li><a href="#">스토리</a></li>
<li><a href="#">사용법</a></li>
<li><a href="#">블로그</a></li>
<li><a href="#">게시판</a></li>
<li><a href="#">로그인</a></li>
<li><a href="#">뉴스</a></li>
<li><a href="#">contact us</a></li>
<li><a href="#">웹툰</a></li>
<div class="stroke"></div>
</ul>
</div>
</body>
</html>