欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)帶滑動(dòng)條的菜單效果代碼

 更新時(shí)間:2015年08月26日 10:47:07   作者:企鵝  
這篇文章主要介紹了jQuery實(shí)現(xiàn)帶滑動(dòng)條的菜單效果代碼,涉及jquery遍歷頁面元素及動(dòng)態(tài)變換效果實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)帶滑動(dòng)條的菜單效果代碼。分享給大家供大家參考。具體如下:

這是一款帶滑動(dòng)條的jQuery滑動(dòng)菜單,菜單下邊有一個(gè)藍(lán)色的線條,鼠標(biāo)移上哪里它就跟向哪里,可以指引當(dāng)前菜單的位置,另外,動(dòng)畫效果是基于jquery的animate(),對(duì)此有興趣學(xué)習(xí)的正好可參考下代碼。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.jb51.net/js/2015/jquery-move-buttom-line-style-codes/

具體代碼如下:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312">
<title>帶滑動(dòng)條的jQuery滑動(dòng)菜單</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>

希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論