大佬教程收集整理的这篇文章主要介绍了jQuery可折叠UL,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是当我在其他父元素之间切换时,我希望能够隐藏先前的子元素,这样我才能打开一个< ul>一次.
的index.html
<div class="rightBottom"> <h1 class="Boxheadings">Other functions</h1> <p class="Boxp">Click this button to view your current published site in a new window. This will not show your most recent changes until you click the ‘Publish Changes’ button on the right,alternatively click view local to see unpublished changes.</p> <ul id="usernav"> <li class="parent">Manage <ul class="child"> <li>child11</li> <li>child12</li> </ul> </li> <li class="parent">Subscriptions <ul class="child"> <li>E-Briefings</li> <li>E-Briefings Subscriptions</li> <li>KNowledge Briefings</li> </ul> </li> <li class="parent">Media Store <ul class="child"> <li>Image Store</li> <li>Document Store</li> <li>Media Store</li> </ul> </li> </ul></div>
JS / js.js
//user nav $('.child').hide(); $('.parent').click(function() { $(this).find('ul').slideToggle(); });
看:
//hide all children initially $('.child').hide(); //adding a click handlers to every all parents $('.parent').click(function() { //slide up the children which are open already $('.child').slideUp(); //find the child of clicked parent and toggle its visibility $(this).find('ul').slideToggle(); });
以上是大佬教程为你收集整理的jQuery可折叠UL全部内容,希望文章能够帮你解决jQuery可折叠UL所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。