Commit 099486f2 authored by Johann-S's avatar Johann-S
Browse files

Detach accordions from .card

parent 95f37e4c
Showing with 11 additions and 2 deletions
+11 -2
...@@ -57,7 +57,8 @@ const Collapse = (($) => { ...@@ -57,7 +57,8 @@ const Collapse = (($) => {
const Selector = { const Selector = {
ACTIVES : '.card > .show, .card > .collapsing', 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 = (($) => { ...@@ -84,6 +85,14 @@ const Collapse = (($) => {
this._addAriaAndCollapsedClass(this._element, this._triggerArray) 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) { if (this._config.toggle) {
this.toggle() this.toggle()
} }
...@@ -124,7 +133,7 @@ const Collapse = (($) => { ...@@ -124,7 +133,7 @@ const Collapse = (($) => {
let activesData let activesData
if (this._parent) { if (this._parent) {
actives = $.makeArray($(this._parent).find(Selector.ACTIVES)) actives = $.makeArray($(this._parent).find(this._selectorActives))
if (!actives.length) { if (!actives.length) {
actives = null actives = null
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment