修改Twitter Bootstrap折叠插件以保持手风琴打开 [英] Modify Twitter Bootstrap collapse plugin to keep accordions open

查看:258
本文介绍了修改Twitter Bootstrap折叠插件以保持手风琴打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修改Bootstrap折叠插件,以允许我指定单击手风琴(打开)是否应自动关闭手风琴中的其他项目(因此手风琴中的多个项目可以一次打开)

I'm trying to modify the Bootstrap collapse plugin to allow me to specify whether clicking an accordion (to open) should automatically close the other items in the accordion (so more than one item in the accordion can be open at a time)

我想在手风琴上创建一个新的数据属性,比如 data-collapse-type =auto | manual

I want to create a new data attribute on the accordion, something like data-collapse-type="auto|manual"

对于我的技能水平,bootstrap jQuery插件有点先进。我需要弄乱的最相关的部分似乎是在第52行, actives.collapse('hide')。如果设置'data-collapse-type =manual',我不希望发生这种情况(省略属性或设置 auto 应该保持默认行为)。

The bootstrap jQuery plugins are a bit advanced for my skill level. The most relevant part of what I need to mess with seems to be on line 52, actives.collapse('hide'). I don't want that to happen if 'data-collapse-type="manual"' is set (omitting the attribute or setting auto should keep the default behavior).

我创建了一个 jsfiddle,我一直在体验

任何人都可以帮忙让我走上正轨吗?

Can anyone help get me on the right track with this?

推荐答案

我已经分叉并更新你的小提琴。

I have forked and updated your fiddle.

只需转到.show函数,我也写了评论。

just go to .show function, I have written also the comments.

http://jsfiddle.net/2Rnpz/

这篇关于修改Twitter Bootstrap折叠插件以保持手风琴打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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