jQuery UI手风琴,保持多个部分打开? [英] jQuery UI accordion that keeps multiple sections open?

查看:89
本文介绍了jQuery UI手风琴,保持多个部分打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能是个白痴,但是如何让jQuery UI的手风琴中的多个部分保持开放?演示文稿一次只能打开一个...我正在寻找一个可折叠的菜单类型系统。

解决方案

最初是在 Accordion的jQuery UI文档


注意:如果您想一次打开多个部分
,请勿使用手风琴


手风琴不允许一个内容面板在同一时间在
打开超过
,并且需要花费很多
的努力才能完成。如果您正在寻找允许多个
内容面板打开的小部件
,请不要使用
这个。通常它可以用
几行jQuery代替,如
这样写:

  jQuery (document).ready(function(){
$('。accordion .head')。click(function(){
$(this).next()。toggle();
返回false;
})。next()。hide();
});

动画:

  jQuery(document).ready(function(){
$('。accordion .head')。click(function(){
$(this).next()。 toggle('slow');
return false;
})。next()。hide();
});


我可能是个白痴 - 你不是如果你没有阅读文档,那么你就是白痴,但如果你遇到问题,通常会加速寻找解决方案。


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.

解决方案

This was originally discussed in the jQuery UI documentation for Accordion:

NOTE: If you want multiple sections open at once, don't use an accordion

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();
});

Or animated:

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手风琴,保持多个部分打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆