jQuery實(shí)現(xiàn)帶滑動(dòng)條的菜單效果代碼
本文實(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ì)有所幫助。
- jQuery實(shí)現(xiàn)MSN中文網(wǎng)滑動(dòng)Tab菜單效果代碼
- jquery實(shí)現(xiàn)標(biāo)題字體變換的滑動(dòng)門菜單效果
- jQuery實(shí)現(xiàn)帶延遲效果的滑動(dòng)菜單代碼
- 基于jQuery實(shí)現(xiàn)的向下滑動(dòng)二級(jí)菜單效果代碼
- jquery實(shí)現(xiàn)左右滑動(dòng)菜單效果代碼
- jQuery實(shí)現(xiàn)帶幻燈的tab滑動(dòng)切換風(fēng)格菜單代碼
- jQuery實(shí)現(xiàn)菜單式圖片滑動(dòng)切換
- jQuery實(shí)現(xiàn)可用于博客的動(dòng)態(tài)滑動(dòng)菜單
- jquery實(shí)現(xiàn)最簡(jiǎn)單的滑動(dòng)菜單效果代碼
相關(guān)文章
jquery實(shí)現(xiàn)checkbox全選全不選的簡(jiǎn)單實(shí)例
本篇文章主要是對(duì)jquery實(shí)現(xiàn)checkbox全選全不選的簡(jiǎn)單實(shí)例進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2013-12-12使用jquery datatable和bootsrap創(chuàng)建表格實(shí)例代碼
這篇文章主要介紹了使用jquery-datatable和bootsrap創(chuàng)建表格的實(shí)例代碼,需要的朋友可以參考下2017-03-03jquery監(jiān)控?cái)?shù)據(jù)是否變化(修正版)
jquery監(jiān)控?cái)?shù)據(jù)是否變化(修正版) 之前寫的那篇中存在許多bug,今天重新整理了一下。還請(qǐng)各位指教2011-04-04淺析jQuery中調(diào)用ajax方法時(shí)在不同瀏覽器中遇到的問題
這篇文章主要介紹了jQuery中調(diào)用ajax方法時(shí)在不同瀏覽器中遇到的問題,因不同瀏覽器默認(rèn)設(shè)置的不同造成的問題2014-06-06PHP+jquery+ajax實(shí)現(xiàn)分頁
這篇文章主要為大家詳細(xì)介紹了PHPjquery+ajax實(shí)現(xiàn)分頁的代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12jQuery實(shí)現(xiàn)的點(diǎn)贊隨機(jī)數(shù)字顯示動(dòng)畫效果(附在線演示與demo源碼下載)
這篇文章主要介紹了jQuery實(shí)現(xiàn)的點(diǎn)贊隨機(jī)數(shù)字顯示動(dòng)畫效果,并附帶在線演示與demo源碼供讀者下載.涉及jQuery鼠標(biāo)事件響應(yīng)及基于animate動(dòng)畫效果實(shí)現(xiàn)技巧,需要的朋友可以參考下2015-12-12