jQuery實(shí)現(xiàn)的動態(tài)伸縮導(dǎo)航菜單實(shí)例
更新時間:2015年05月07日 16:03:58 投稿:shichen2014
這篇文章主要介紹了jQuery實(shí)現(xiàn)的動態(tài)伸縮導(dǎo)航菜單,實(shí)例分析了jQuery鼠標(biāo)事件及animate、hide等方法的使用技巧,需要的朋友可以參考下
本文實(shí)例講述了jQuery實(shí)現(xiàn)的動態(tài)伸縮導(dǎo)航菜單。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
<!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>jquery select</title>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<style type="text/css">
body {padding:10px; font-family:"宋體"}
* {margin:0; padding:0; font-size:12px;}
a{ color: #333;}
ul,li {
list-style-type:none;
}
.menu_list li a {
display:block; line-height:30px;
text-align:center; height:30px;
background:#e8e8e8; border-bottom:1px solid #ccc;
}
.hover {
background:#e8e8e8;
}
.div1{
height:200px; display:none;
padding:5px;
}
.menu_list{
width:200px; background:#f2f2f2;
border:1px solid #ccc;
}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$(".menu_list ul li").click(function()
{
if($(this).children(".div1").is(":hidden"))
//判斷對象是顯示還是隱藏
{
if(!$(this).children(".div1").is(":animated")){
//如果當(dāng)前沒有進(jìn)行動畫,則添加新動畫
$(this).children(".div1").animate({height:'show'},1000)
.end().siblings().find(".div1").hide(1000);}
}else{
if(!$(this).children(".div1").is(":animated")){
$(this).children(".div1").animate({height:'hide'},1000)
.end().siblings().find(".div1").hide(1000);}
}
}
);
});
</script>
<div class="menu_list" id="secondpane">
<ul>
<li class="">
<a href="javascript:void(0);" class="a1">網(wǎng)頁特效</a>
<div class="div1">js特效,網(wǎng)頁特效</div>
</li>
<li class="">
<a href="javascript:void(0);" class="a1">網(wǎng)頁模板</a>
<div class="div1">網(wǎng)頁模板下載</div>
</li>
<li class="">
<a href="javascript:void(0);" class="a1" style="border:none;">聯(lián)系我們 </a>
<div class="div1" style="border-top:1px solid #ccc;">關(guān)于腳本之家</div>
</li>
</ul>
</div>
</body>
</html>
希望本文所述對大家的jQuery程序設(shè)計有所幫助。
您可能感興趣的文章:
- JQuery 寫的個性導(dǎo)航菜單
- 基于jquery實(shí)現(xiàn)導(dǎo)航菜單高亮顯示(兩種方法)
- jQuery彈性滑動導(dǎo)航菜單實(shí)現(xiàn)思路及代碼
- Jquery實(shí)現(xiàn)帶動畫效果的經(jīng)典二級導(dǎo)航菜單
- 基于jQuery的簡單的列表導(dǎo)航菜單
- 純CSS打造的導(dǎo)航菜單(附j(luò)query版)
- jQuery三級下拉列表導(dǎo)航菜單代碼分享
- Jquery+CSS 創(chuàng)建流動導(dǎo)航菜單 Fluid Navigation
- jQuery實(shí)現(xiàn)簡潔的導(dǎo)航菜單效果
- jQuery漸變發(fā)光導(dǎo)航菜單的實(shí)例代碼
- 分享14個很酷的jQuery導(dǎo)航菜單插件
- jQuery實(shí)現(xiàn)的背景動態(tài)變化導(dǎo)航菜單效果
- 制作jquery遮罩層效果導(dǎo)航菜單代碼分享
- jQuery實(shí)現(xiàn)簡單漂亮的Nav導(dǎo)航菜單效果
相關(guān)文章
jQuery選擇器源碼解讀(四):tokenize方法的Expr.preFilter
這篇文章主要介紹了jQuery選擇器源碼解讀(四):tokenize方法的Expr.preFilter,本文用詳細(xì)的注釋解讀了tokenize方法的Expr.preFilter的實(shí)現(xiàn)源碼,需要的朋友可以參考下2015-03-03
jquery的總體架構(gòu)分析及實(shí)現(xiàn)示例詳解
學(xué)習(xí)開源框架,童鞋們最想學(xué)到的就是設(shè)計的思想和實(shí)現(xiàn)的技巧。最近研究jQuery源碼,記錄一下我對jquery的理解和心得,跟大家分享,權(quán)當(dāng)拋磚引玉。2014-11-11
jQuery調(diào)用RESTful WCF示例代碼(GET方法/POST方法)
本篇文章主要介紹了jQuery調(diào)用RESTful WCF示例代碼(GET方法/POST方法),需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01
jQuery實(shí)現(xiàn)帶漸顯效果的人物多級關(guān)系圖代碼
這篇文章主要介紹了jQuery實(shí)現(xiàn)帶漸顯效果的人物多級關(guān)系圖,可實(shí)現(xiàn)多種關(guān)系的顯示及點(diǎn)擊后漸顯切換效果,涉及jQuery響應(yīng)鼠標(biāo)事件動態(tài)修改頁面元素顯示效果的相關(guān)技巧,需要的朋友可以參考下2015-10-10
jQuery實(shí)現(xiàn)獲取當(dāng)前鼠標(biāo)位置并輸出功能示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)獲取當(dāng)前鼠標(biāo)位置并輸出功能,涉及jQuery事件響應(yīng)及頁面元素屬性動態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2019-01-01

