jquery 层次结构手风琴树
我需要一个关于如何使手风琴树分层的建议。有很多可用的插件,但它们不符合我的要求。
我的要求如下:假设我单击我的子节点,那么它应该成为其其余子元素的父节点,如果我再次单击它,那么它应该显示其子元素的父元素。
我想从使用 jQuery 开始。
I need a suggestion regarding how I can make an accordion tree hierarchical. There are many plugins available, but they do not fit my requirement.
My requirement is as follows: Suppose I click on my child node, then that should become the parent node for the rest of its child elements, and if I click on it again then it should display its child's parent element.
I want to start by using jQuery.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非我误会,否则您应该能够嵌套 JqueryUI 手风琴。如果你想让它显示为树,你可以更改 JQueryUI css。
参见这里:
http://jsbin.com/adole3/edit
但是,请注意,对于手风琴,只有一个部分手风琴的一侧可以一次打开。如果您希望同时打开多个部分,请查看本页注释下的代码:
http://docs.jquery.com/UI/Accordion
这是一个实现(没有样式) 由上可知:
http://jsbin.com/enika3/2/edit
Unless I am misunderstanding, you should be able to nest the JqueryUI accordions. If you want to make it appear as a tree, you can change the JQueryUI css.
See here:
http://jsbin.com/adole3/edit
However, note that with an accordion, only one section of the accordion can be open at a time. If you want several sections to be open at once, view the code under the note on this page:
http://docs.jquery.com/UI/Accordion
Here is an implementation (no styles) from the above:
http://jsbin.com/enika3/2/edit