jQuery實(shí)現(xiàn)帶動(dòng)畫(huà)效果的二級(jí)下拉導(dǎo)航方法
本文實(shí)例講述了jQuery實(shí)現(xiàn)帶動(dòng)畫(huà)效果的二級(jí)下拉導(dǎo)航方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery二級(jí)下滑導(dǎo)菜單</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.effects.core.min.js"></script>
<style type="text/css">
body{ font-size:12px; font-family:Arial, Helvetica, sans-serif; margin:0; padding:10px;}
.nav_list{ list-style:none; margin:0; padding:0;}
.nav_list li{ float:left; text-align:center; margin-right:10px; position:relative;}
.nav_list li a{ width:80px; text-align:center; padding:4px 0; text-decoration:none;color:#ccc; background:#996666; display:block; float:left;}
.nav_list li a.current{ width:80px; text-align:center; padding:4px 0; text-decoration:none;color:#fff; background:#f00; display:block; float:left;}
.nav_list li div.second{ color:#999999; height:0px; overflow:hidden; position:absolute; left:0; top:22px; width:80px;}
.nav_list li div.second a{ background:#666666; color:#fff; border:none; width:80px; border-top:1px solid
#FFFFFF; padding:5px 0;}
</style>
<script type="text/javascript">
$(function(){
Menu(".nav_list");
});
function Menu(ul_class_name){
Second(".nav_list");
var li_name = ul_class_name+" "+"li";
$("div.second").css("opacity","0.1");
$(li_name).hover(
function(){
var a_height = $(this).children("div.second a:first").css("height");
var a_count = $(this).children("div.second").children("a").length;
var slide_hieght = (parseInt(a_height)+11)*a_count;
$(this).children("div.second").stop().animate({height:slide_hieght+"px",opacity:"0.9"},600);
$(this).children("a:not(.current)").stop().animate({backgroundColor:"#f00",color:"#fff"},800);
},function(){
$(this).children("div.second").stop().animate({height:"0px",opacity:"0.1"},600);
$(this).children("a:not(.current)").stop().animate({backgroundColor:"#996666",color:"#ccc"},800);
});
}
function Second(ul_class_name){
var second_menu = ul_class_name+" "+"li"+" "+"div.second"+" "+">"+" "+"a";
$(second_menu).hover(
function(){
$(this).stop().animate({backgroundColor:"#000",opacity:"1"},400);
},function(){
$(this).stop().animate({backgroundColor:"#666",opacity:"0.9"},400);
});
}
</script>
</head>
<body>
<ul class="nav_list">
<li>
<a href="#" class="current">Test_1</a>
<div class="second">
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
</div>
<li>
<li>
<a href="#">Test_2</a>
<div class="second">
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
<a href="#">menu_1</a>
</div>
<li>
<li>
<a href="#">Test_3</a>
<div class="second">
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
<a href="#">menu_3</a>
</div>
<li>
<li>
<a href="#">Test_4</a>
<div class="second">
<a href="#">menu_4</a>
<a href="#">menu_4</a>
<a href="#">menu_4</a>
</div>
<li>
<li>
<a href="#">Test_5</a>
<div class="second">
<a href="#">menu_5</a>
<a href="#">menu_5</a>
<a href="#">menu_5</a>
</div>
<li>
</ul>
<div style="width:800px; clear:both; padding:10px;">
<p>這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字這是一段文字</p>
</div>
</body>
</html>
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
- 基于jquery實(shí)現(xiàn)百度新聞導(dǎo)航菜單滑動(dòng)動(dòng)畫(huà)
- 基于jQuery實(shí)現(xiàn)鼠標(biāo)點(diǎn)擊導(dǎo)航菜單水波動(dòng)畫(huà)效果附源碼下載
- jQuery實(shí)現(xiàn)兩款有動(dòng)畫(huà)功能的導(dǎo)航菜單代碼
- 一款基jquery超炫的動(dòng)畫(huà)導(dǎo)航菜單可響應(yīng)單擊事件
- 利用jquery動(dòng)畫(huà)特效和css打造的側(cè)邊彈出垂直導(dǎo)航
- jquery實(shí)現(xiàn)隱藏與顯示動(dòng)畫(huà)效果/輸入框字符動(dòng)態(tài)遞減/導(dǎo)航按鈕切換
- Jquery實(shí)現(xiàn)帶動(dòng)畫(huà)效果的經(jīng)典二級(jí)導(dǎo)航菜單
- jQuery實(shí)現(xiàn)的導(dǎo)航動(dòng)畫(huà)效果(附demo源碼)
相關(guān)文章
jQuery動(dòng)態(tài)增減行的實(shí)例代碼解析(推薦)
這篇文章主要介紹了jQuery動(dòng)態(tài)增減行的實(shí)例代碼解析,本文圖文并茂給大家介紹的非常詳細(xì),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-12-12JQuery開(kāi)發(fā)的數(shù)獨(dú)游戲代碼
08年的時(shí)候裝上ubuntu試用了一下,發(fā)現(xiàn)里面自帶了一個(gè)數(shù)獨(dú)游戲,索性自己用jquery做了一個(gè)數(shù)獨(dú)游戲。2010-10-10從零學(xué)jquery之如何使用回調(diào)函數(shù)
回調(diào)函數(shù)指的是被調(diào)用者完成處理后自動(dòng)回調(diào)調(diào)用者預(yù)先傳遞的函數(shù)。2014-05-05一個(gè)分享按鈕的插件使用介紹(可擴(kuò)展,內(nèi)附開(kāi)發(fā)制作流程)
前幾天由于工作需要制作一個(gè)分享按鈕,考慮到后續(xù)其他項(xiàng)目可能也會(huì)用到,于是就打算寫(xiě)成插件化2011-09-09jquery實(shí)現(xiàn)動(dòng)態(tài)操作select選中
文章主要向大家介紹了jQuery 根據(jù)值或者文本選中select的方法和示例,非常實(shí)用的功能,需要的朋友可以參考下2015-02-02jquery實(shí)現(xiàn)的淡入淡出下拉菜單效果
這篇文章主要介紹了jquery實(shí)現(xiàn)的淡入淡出下拉菜單效果,涉及jquery操作頁(yè)面屬性的動(dòng)態(tài)添加與刪除相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08jQuery AJAX timeout 超時(shí)問(wèn)題詳解
這篇文章主要介紹了jQuery AJAX timeout 超時(shí)問(wèn)題詳解的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-06-06