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

首頁 > 編程 > JavaScript > 正文

jquery實(shí)現(xiàn)樹形二級菜單實(shí)例代碼

2019-11-20 21:38:46
字體:
供稿:網(wǎng)友

直接上代碼:

復(fù)制代碼 代碼如下:

<!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實(shí)現(xiàn)的樹形列表菜單(Menu Tree) </title>
<meta name="Copyright" content=" //www.survivalescaperooms.com/" />
<meta name="description" content="jQuery實(shí)現(xiàn)的樹形列表菜單(Menu Tree),JavaScript分享網(wǎng)" />
<meta content="JavaScript,分享,JavaScript代碼,Ajax" name="keywords" />

<style type="text/css">
.padding {height:300px;}
 This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this stylesheet and the associated (x)html
is available at //www.survivalescaperooms.com
Copyright (c) 2005-2008 Stu Nicholls. All rights reserved.
This stylesheet and the associated (x)html may be modified in any 
way to fit your requirements.

 
#wrap {position:relative; height:200px; width:130px; z-index:100;}
#nav {position:absolute; left:0; top:0;}
#nav, 
#nav ul {padding:0; margin:0; list-style:none; font-family:arial, sans-serif; background:#fff; font-weight:bold;}
#nav li a {padding-left:20px; white-space:nowrap;}
#nav li ul li a {padding-left:0;}

#nav ul {padding-left:20px;}
#nav li a {color:#66b; text-decoration:none; font-size:11px;}
#nav li {font-size:13px; line-height:25px; color:#d80; cursor:pointer; width:100%;}
#nav li.down {text-indent:20px;}

#nav li a:hover {text-decoration:underline;}

</style>

 
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>

<script type="text/javascript">
 This copyright notice must be untouched at all times.
Copyright (c) 2008 Stu Nicholls - stunicholls.com - all rights reserved.

$(document).ready(function() {

$("ul#nav ul").hide();
$('ul#nav li:has(ul)').each(function(i) {
$(this).children().slideUp(400);
});

$('li.p1:has(ul)').click(function(event){
        if (this == event.target) {
        current = this;
        $('ul#nav li:has(ul)').each(function(i) {
        if (this != current) {$(this).children().slideUp(400);}
        });
        $(this).children("ul:eq(0)").slideToggle(400);
        }
    });

});

 
</script>

</head>
<body>

 
<div id="wrap">
<ul id="nav">
<li><a href="#url">Home</a></li>
<li class="p1 down">Products
    <ul>
        <li><a href="#url">Flashguns</a></li>
        <li><a href="#url">Tripods</a></li>
        <li><a href="#url">Filters</a></li>
    </ul>
</li>
<li class="p1 down">Services
    <ul>
        <li><a href="#url">Printing</a></li>
        <li><a href="#url">Photo Framing</a></li>
        <li><a href="#url">Retouching</a></li>
        <li><a href="#url">Archiving</a></li>
    </ul>
</li>
</ul>
</div>
</body>
</html>


其中的jquery的地址自己得換一個(gè)能夠找到的,要不沒有效果

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 祁阳县| 文安县| 肇州县| 丰县| 宝丰县| 澄江县| 肥城市| 璧山县| 镇赉县| 长兴县| 筠连县| 剑川县| 泸西县| 海城市| 育儿| 堆龙德庆县| 福建省| 明光市| 晋江市| 自贡市| 永寿县| 芷江| 无为县| 宣恩县| 茌平县| 襄垣县| 越西县| 东乌珠穆沁旗| 周至县| 历史| 镇巴县| 得荣县| 蓬安县| 甘泉县| 隆回县| 巴林左旗| 江阴市| 新兴县| 昌平区| 台安县| 页游|