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>jquery二级树形菜单</title> <mce:style type="text/css"><!-- body { margin: 50px; font-family: Arial, Helvetica, sans-serif; } ul { margin: 0; padding: 0; } li { list-style: none; } #menuTree { background-color: #e5e5e5; width: 180px; } #menuTree h3 { background-color: #aaa; margin: 0; padding: 4px; font-size: 12px; cursor: pointer; border-bottom: solid 1px #999; } #menuTree ul { margin: 6px 12px; font-size: 11px; } #menuTree div { display: none; } #menuTree h3.blue { background: #069; color: #fff; } --></mce:style><style type="text/css" mce_bogus="1">body { margin: 50px; font-family: Arial, Helvetica, sans-serif; } ul { margin: 0; padding: 0; } li { list-style: none; } #menuTree { background-color: #e5e5e5; width: 180px; } #menuTree h3 { background-color: #aaa; margin: 0; padding: 4px; font-size: 12px; cursor: pointer; border-bottom: solid 1px #999; } #menuTree ul { margin: 6px 12px; font-size: 11px; } #menuTree div { display: none; } #menuTree h3.blue { background: #069; color: #fff; }</style> <mce:style type="text/css"><!-- body { margin: 50px; font-family: Arial, Helvetica, sans-serif; } ul { margin: 0; padding: 0; } li { list-style: none; } #menuTree { background-color: #e5e5e5; width: 180px; } #menuTree h3 { background-color: #aaa; margin: 0; padding: 4px; font-size: 12px; cursor: pointer; border-bottom: solid 1px #999; } #menuTree ul { margin: 6px 12px; font-size: 11px; } #menuTree div { display: none; } #menuTree h3.blue { background: #069; color: #fff; } --></mce:style><style type="text/css" mce_bogus="1">body { margin: 50px; font-family: Arial, Helvetica, sans-serif; } ul { margin: 0; padding: 0; } li { list-style: none; } #menuTree { background-color: #e5e5e5; width: 180px; } #menuTree h3 { background-color: #aaa; margin: 0; padding: 4px; font-size: 12px; cursor: pointer; border-bottom: solid 1px #999; } #menuTree ul { margin: 6px 12px; font-size: 11px; } #menuTree div { display: none; } #menuTree h3.blue { background: #069; color: #fff; }</style> <mce:script type="text/javascript" src="./js/jquery.js" mce_src="js/jquery.js"></mce:script> <mce:script type="text/javascript"><!-- $(document).ready(function(){ $("#menuTree h3").hover( function(){ $(this).addClass("blue"); }, function(){ $(this).removeClass("blue"); } ); $("#menuTree h3").toggle( function(){ $(this).next("div").show("slow"); }, function(){ $(this).next("div").hide("slow"); } ); }) // --></mce:script> </head> <body> <ul id="menuTree"> <li> <h3> mainMenu 1 </h3> <div> <ul> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 1</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 2</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 3</a> </li> </ul> </div> </li> <li> <h3> mainMenu 2 </h3> <div> <ul> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 1</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 2</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 3</a> </li> </ul> </div> </li> <li> <h3> mainMenu 3 </h3> <div> <ul> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 1</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 2</a> </li> <li> <a href="#" mce_href="#" href="#" mce_href="#">subMenu 3</a> </li> </ul> </div> </li> </ul> </body> </html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值