国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

JQuery伸縮導航練習示例

2024-05-06 15:54:50
字體:
來源:轉載
供稿:網友
伸縮的導航有不少優點的,可以在有限的空間里容下很多的內容,下面有個不錯的示例用到JQuery,感興趣的朋友可以參考下

最近在學習JQuery,嘗試制作了這個導航

JQuery伸縮導航練習示例

 
下載:代碼

復制代碼 代碼如下:


<!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>伸縮導航</title>
<link type="text/css" href="nav.css">
<script type="text/javascript" src="jquery-1.10.2.js"></script>
<script type="text/javascript" src="nav.js"></script>
</head>
<body>
<div>
<ul>
<li>
<h3>導航卡1</h3>
<ul>
<li>子項目1</li>
<li>子項目2</li>
<li>子項目3</li>
<li>子項目4</li>
</ul>
</li>
<li>
<h3>導航卡2</h3>
<ul>
<li>子項目1</li>
<li>子項目2</li>
<li>子項目3</li>
<li>子項目4</li>
</ul>
</li>
<li>
<h3>導航卡3</h3>
<ul>
<li>子項目1</li>
<li>子項目2</li>
<li>子項目3</li>
<li>子項目4</li>
</ul>
</li>
</ul>
</div>

</body>
</html>


復制代碼 代碼如下:


/**
* Author LY 2013-11-11 22:30
**/

* {
margin: 0;
padding: 0;
font-family: "Microsoft Yahei","Arial"
}

.navigator {
width: 180px;
display: block;
margin-top: 30px;
margin-left: 30px;
border-top: 10px solid #ddd;
border-bottom: 10px solid #ddd;
border-left: 3px solid #ddd;
border-right: 3px solid #ddd;
background: #ddd;
}
.tabs {
list-style: none;

}

.tabs li {
clear: both;
overflow: auto;
}

.tabs li h3 {
padding: 0;
margin:0;
font-size: 14px;
height: 40px;
line-height: 40px;
text-align: center;
width: 180px;
cursor: pointer;
background: #07f;
color: #fff;
border-bottom: 1px solid #ccc;
}
.tabs li:last-child h3 {
border:none;
}
.tabs li h3.current {
background: #6af;
}
.tabs li ul {
margin-left: auto;
margin-right: auto;
width: 160px;
height: 0px;
list-style: none;
overflow: hidden;
}
.tabs li ul li {
height: 30px;
line-height: 30px;
background: #eee;
padding: 5px;
border-bottom: 1px solid #ccc;
cursor: pointer;
}


復制代碼 代碼如下:


$(document).ready(function(){
$(".nav1").css("height","160px");
$(".tabs li h3:first").addClass("current");
$(".tabs li h3").click(function() {
$(".tabs li h3").removeClass("current");
$(this).addClass("current");
$(".tabs li ul").animate({height:"0"},"fast");
$(this).next().animate({height:"160"},"slow");
});
});

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 内黄县| 西乌| 甘南县| 郴州市| 临桂县| 安阳县| 辽宁省| 武清区| 延长县| 万荣县| 集贤县| 定州市| 凤山市| 时尚| 南江县| 资阳市| 石城县| 灵宝市| 夏河县| 广安市| 东港市| 九江市| 巴塘县| 德兴市| 通榆县| 烟台市| 乐陵市| 弋阳县| 彭泽县| 原阳县| 阜阳市| 黄浦区| 汾阳市| 外汇| 赞皇县| 邵东县| 贵港市| 石阡县| 新乐市| 皋兰县| 新安县|