jQuery實現(xiàn)的動態(tài)伸縮導航菜單實例
更新時間:2015年05月07日 16:03:58 投稿:shichen2014
這篇文章主要介紹了jQuery實現(xiàn)的動態(tài)伸縮導航菜單,實例分析了jQuery鼠標事件及animate、hide等方法的使用技巧,需要的朋友可以參考下
本文實例講述了jQuery實現(xiàn)的動態(tài)伸縮導航菜單。分享給大家供大家參考。具體實現(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")){
//如果當前沒有進行動畫,則添加新動畫
$(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;">關于腳本之家</div>
</li>
</ul>
</div>
</body>
</html>
希望本文所述對大家的jQuery程序設計有所幫助。
您可能感興趣的文章:
- JQuery 寫的個性導航菜單
- 基于jquery實現(xiàn)導航菜單高亮顯示(兩種方法)
- jQuery彈性滑動導航菜單實現(xiàn)思路及代碼
- Jquery實現(xiàn)帶動畫效果的經(jīng)典二級導航菜單
- 基于jQuery的簡單的列表導航菜單
- 純CSS打造的導航菜單(附jquery版)
- jQuery三級下拉列表導航菜單代碼分享
- Jquery+CSS 創(chuàng)建流動導航菜單 Fluid Navigation
- jQuery實現(xiàn)簡潔的導航菜單效果
- jQuery漸變發(fā)光導航菜單的實例代碼
- 分享14個很酷的jQuery導航菜單插件
- jQuery實現(xiàn)的背景動態(tài)變化導航菜單效果
- 制作jquery遮罩層效果導航菜單代碼分享
- jQuery實現(xiàn)簡單漂亮的Nav導航菜單效果
相關文章
jQuery選擇器源碼解讀(四):tokenize方法的Expr.preFilter
這篇文章主要介紹了jQuery選擇器源碼解讀(四):tokenize方法的Expr.preFilter,本文用詳細的注釋解讀了tokenize方法的Expr.preFilter的實現(xiàn)源碼,需要的朋友可以參考下2015-03-03
jQuery調用RESTful WCF示例代碼(GET方法/POST方法)
本篇文章主要介紹了jQuery調用RESTful WCF示例代碼(GET方法/POST方法),需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01

