当前位置:编程学习 > JAVA >>

jQuery 复习之折叠菜单 简洁代码

<html>
<head>

<script src='js/min.js'></script>
<script src='js/menu.js'></script>


</head>


<body>
<ul class="m-treeview">
<li class="m-expanded">
<span>衬衫</span>
<ul>
<li><span>短袖衬衫</span></li>
<li><span>长袖衬衫</span></li>
</ul>
</li>
<li class="m-expanded">
<span>卫衣</span>
<ul>
<li ><span>开襟卫衣</span></li>
<li ><span>套头卫衣</span></li>
</ul>
</li>
   </ul>
</body>

 

</html>

 

 

 

$(function(){


$('.m-expanded span').click(function(){

$(this).siblings('ul').toggle();

});


})


 

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,