diff options
| author | Johann-S <[email protected]> | 2017-03-07 10:46:08 +0100 |
|---|---|---|
| committer | Johann-S <[email protected]> | 2017-03-07 10:46:08 +0100 |
| commit | 099486f294e79bfe1f2c6b431ee4696237f616cd (patch) | |
| tree | 1d9ae14a3ad3b09e61dd2bc7ed0287bb4f5fca81 /js | |
| parent | 95f37e4c402df37db16781995ffa1592032df9c8 (diff) | |
| download | bootstrap-099486f294e79bfe1f2c6b431ee4696237f616cd.tar.xz bootstrap-099486f294e79bfe1f2c6b431ee4696237f616cd.zip | |
Detach accordions from .card
Diffstat (limited to 'js')
| -rw-r--r-- | js/src/collapse.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js index 28c4493cc..e2c9efe11 100644 --- a/js/src/collapse.js +++ b/js/src/collapse.js @@ -57,7 +57,8 @@ const Collapse = (($) => { const Selector = { ACTIVES : '.card > .show, .card > .collapsing', - DATA_TOGGLE : '[data-toggle="collapse"]' + DATA_TOGGLE : '[data-toggle="collapse"]', + DATA_CHILDREN : 'data-children' } @@ -84,6 +85,14 @@ const Collapse = (($) => { this._addAriaAndCollapsedClass(this._element, this._triggerArray) } + this._selectorActives = Selector.ACTIVES + if (this._parent) { + const childrenSelector = this._parent.hasAttribute(Selector.DATA_CHILDREN) ? this._parent.getAttribute(Selector.DATA_CHILDREN) : null + if (childrenSelector !== null) { + this._selectorActives = childrenSelector + ' > .show, ' + childrenSelector + ' > .collapsing' + } + } + if (this._config.toggle) { this.toggle() } @@ -124,7 +133,7 @@ const Collapse = (($) => { let activesData if (this._parent) { - actives = $.makeArray($(this._parent).find(Selector.ACTIVES)) + actives = $.makeArray($(this._parent).find(this._selectorActives)) if (!actives.length) { actives = null } |
