jQuery實現(xiàn)兩款有動畫功能的導(dǎo)航菜單代碼
本文實例講述了jQuery實現(xiàn)兩款有動畫功能的導(dǎo)航菜單代碼。分享給大家供大家參考。具體如下:
這里介紹兩個有動畫功能的jQuery導(dǎo)航菜單,每個具備移動背景的效果,第二則是漸變背景效果,兩個都不錯,根據(jù)你的喜好選擇了,菜單的風(fēng)格和顏色自己修改一下就能用了。
運行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-2-animate-style-nav-menu-codes/
具體代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>兩個有動畫功能的導(dǎo)航菜單</title> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("#test1 a").mouseover(function() { var index = $("#test1 a").index(this); var width = $("#test1 a").width(); $("#test1 .showhover").stop().animate({left:width*index},1000); }) $("#test2 a").mouseover(function() { var index = $("#test2 a").index(this); var width = $("#test2 a").width(); $("#test2 .showhover").stop().animate({left:width*index,opacity:'0.6'},1000).stop(false,true).animate({opacity:'1.0'},500); }) }) </script> <style type="text/css"> .body {margin:10px;} img {border:0;} a {text-decoration:none;} ul{list-style:none; margin:0; padding:0;} .menu {background:#003399; height:25px; width:600px; position:relative; overflow:hidden;} .menu .showmenu, .menu .showhover{ position:absolute;} .menu .showmenu a {float:left; display:block;} .menu .showmenu a {font:700 12px/25px Microsoft YaHei; color:#fff; width:100px; height:25px; text-align:center;} .menu .showhover {background:#990033; width:100px; height:25px;} </style> </head> <body> <div class="menu" id="test1"> <div class="showhover"></div> <div class="showmenu"> <a href="#">網(wǎng)站首頁</a> <a href="#">關(guān)于我們</a> <a href="#">新聞中心</a> <a href="#">產(chǎn)品中心</a> <a href="#">解決方案</a> <a href="#">聯(lián)系我們</a> </div> </div> <div style="clear:both;height:50px;"></div> <div class="menu" id="test2"> <div class="showhover"></div> <div class="showmenu"> <a href="#">網(wǎng)站首頁</a> <a href="#">關(guān)于我們</a> <a href="#">新聞中心</a> <a href="#">產(chǎn)品中心</a> <a href="#">解決方案</a> <a href="#">聯(lián)系我們</a> </div> </div> </body> </html>
希望本文所述對大家的jQuery程序設(shè)計有所幫助。
- 基于jquery實現(xiàn)百度新聞導(dǎo)航菜單滑動動畫
- 基于jQuery實現(xiàn)鼠標點擊導(dǎo)航菜單水波動畫效果附源碼下載
- jQuery實現(xiàn)帶動畫效果的二級下拉導(dǎo)航方法
- 一款基jquery超炫的動畫導(dǎo)航菜單可響應(yīng)單擊事件
- 利用jquery動畫特效和css打造的側(cè)邊彈出垂直導(dǎo)航
- jquery實現(xiàn)隱藏與顯示動畫效果/輸入框字符動態(tài)遞減/導(dǎo)航按鈕切換
- Jquery實現(xiàn)帶動畫效果的經(jīng)典二級導(dǎo)航菜單
- jQuery實現(xiàn)的導(dǎo)航動畫效果(附demo源碼)
相關(guān)文章
Jquery實時監(jiān)聽input value的實例
下面小編就為大家?guī)硪黄狫query實時監(jiān)聽input value的實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-01-01基于JQuery實現(xiàn)異步刷新的代碼(轉(zhuǎn)載)
JQuery,是輕量級的js庫,把繁瑣的js代碼封裝,使調(diào)用更簡單,完成更多功能。同樣,封裝了js利用XMLHttpRequest實現(xiàn)的異步刷新.2011-03-03checkbox全選/取消全選以及checkbox遍歷jQuery實現(xiàn)代碼
checkbox全選/取消全選以及checkbox遍歷jQuery實現(xiàn)代碼2009-12-12jquery的trigger和triggerHandler的區(qū)別示例介紹
這篇文章主要介紹了jquery的trigger和triggerHandler的區(qū)別,需要的朋友可以參考下2014-04-04