html代二级菜单的实例,jquery实现树形二级菜单实例代码

jquery实现的树形列表菜单(Menu Tree)

.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 http://www.jb51.net

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;}

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);

}

});

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值