<!DOCTYPE HTML>
<html>
<head>
<meta charset=
"gb2312"
>
<title>带滑动条的jQuery滑动菜单</title>
<style>
body{ font:12px/1.5 Arial,\5b8b\4f53,sans-serif;background:#fff; color:#333; position:relative}
.header { width:990px; min-width:990px; margin:0 auto; height:68px; position:relative; z-index:200; overflow:hidden}
.headerTab { height:44px; padding:24px 0 0 0; position:relative; width:990px; min-width:990px; margin:0 auto; }
.headerTab a { padding:0 5px; float:left; font-size:14px; color:#333; height:42px; overflow:hidden; line-height:44px;font-family:\5FAE\8F6F\96C5\9ED1,\5B8B\4F53; margin-left:10px; display:inline}
.headerTab a:hover { text-decoration:none; color:#333}
.headerTab .tabLine { position:absolute; top:66px; height:2px; background:#35b0f2; left:0; width:100%; overflow:hidden; font-size:0; line-height:0;}
</style>
</head>
<body>
<div
class
=
"headerTab"
id=
"headerTab"
><a href=
"#"
title=
""
>脚本之家</a><a href=
"#"
title=
""
>下载中心</a><a href=
"#"
title=
""
>最新更新</a><a href=
"#"
title=
""
>广告中心</a><a href=
"#"
target=
"_blank"
title=
""
>Delphi源码</a><a href=
"#"
target=
"_blank"
title=
""
>VC++源码</a><a href=
"#"
title=
""
>更新日志</a><i
class
=
"tabLine"
></i></div>
</body>
<script type=
"text/javascript"
src=
"jquery-1.6.2.min.js"
></script>
<script>
var
headerTabArray = $(
"#headerTab a"
),headTabLine = $(
"#headerTab .tabLine"
),tabIndex,headerTabArrayLength = headerTabArray.length,headerTabWidthArray = [],headerTabPositonArray = [],defaultNum = 0;
for
(
var
i=0;i<headerTabArrayLength;i++){
headerTabWidthArray[i] = headerTabArray.eq(i).width() + 10;
headerTabPositonArray[i] = headerTabArray.eq(i).position().left + 10;
}
headerTabArray.mouseover(
function
(){
$(
"#headerTab i:animated"
).stop();
tabIndex = $(this).index();
headTabLine.animate({width:headerTabWidthArray[tabIndex],left:headerTabPositonArray[tabIndex]},300);
})
headerTabArray.mouseout(
function
(){
$(
"#headerTab i:animated"
).stop();
tabIndex = $(this).index();
headTabLine.animate({width:headerTabWidthArray[defaultNum],left:headerTabPositonArray[defaultNum]},300);
})
defaultNum = 0;
headTabLine.animate({width:headerTabWidthArray[defaultNum],left:headerTabPositonArray[defaultNum]},300);
</script>
</html>