Skip to content
This repository was archived by the owner on Aug 5, 2020. It is now read-only.

Commit 7809b34

Browse files
author
Marlow Payne
committed
🐛 Fix #63: Short circuit out if other items are opening
1 parent e3819f5 commit 7809b34

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

dist/bellows.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@
137137
.attr('aria-hidden', true);
138138
},
139139

140+
/*
141+
Checks if other bellows items are currently opening
142+
*/
143+
_othersAreOpening: function() {
144+
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
145+
},
146+
140147
toggle: function($item) {
141148
$item = this._item($item);
142149

@@ -155,6 +162,11 @@
155162

156163
if (this.options.singleItemOpen) {
157164
this.closeAll();
165+
166+
// Fix #63
167+
if (this._othersAreOpening()) {
168+
return;
169+
}
158170
}
159171

160172
this._trigger('open', {item: $item});

dist/bellows.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/bellows.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@
137137
.attr('aria-hidden', true);
138138
},
139139

140+
/*
141+
Checks if other bellows items are currently opening
142+
*/
143+
_othersAreOpening: function() {
144+
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
145+
},
146+
140147
toggle: function($item) {
141148
$item = this._item($item);
142149

@@ -155,6 +162,11 @@
155162

156163
if (this.options.singleItemOpen) {
157164
this.closeAll();
165+
166+
// Fix #63
167+
if (this._othersAreOpening()) {
168+
return;
169+
}
158170
}
159171

160172
this._trigger('open', {item: $item});

0 commit comments

Comments
 (0)