问题描述
我可能是个白痴,但是如何在 jQuery UI 的手风琴中保持多个部分打开?演示一次只打开一个...我正在寻找可折叠的菜单类型系统.
I may be an idiot, but how do you keep multiple sections in jQuery UI's accordion open? The demos all have only one open at a time... I'm looking for a collapseable menu type system.
推荐答案
这个 最初在 手风琴的 jQuery UI 文档中讨论:
This was originally discussed in the jQuery UI documentation for Accordion:
注意:如果您想要多个部分立即打开,不要使用手风琴
手风琴不允许超过将在以下位置打开一个内容面板同时,需要很多时间努力做到这一点.如果你正在寻找对于允许多个的小部件内容面板要打开,不要使用这.通常它可以写成几行 jQuery 代替,一些东西像这样:
An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:
jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle();
return false;
}).next().hide();
});
或动画:
jQuery(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().toggle('slow');
return false;
}).next().hide();
});
我可能是个白痴" - 如果您不阅读文档,您就不是白痴,但如果您遇到问题,通常可以加快找到解决方案的速度.
"I may be an idiot" - You're not an idiot if you don't read the documentation, but if you're having problems, it usually speeds up finding a solution.
这篇关于保持多个部分打开的 jQuery UI 手风琴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!