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

Commit 7935406

Browse files
author
Steve Calvert
committed
Namespacing event
1 parent add4f0d commit 7935406

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

dist/bellows.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
ITEM_CONTENT: '> .bellows__item > .bellows__content'
2626
};
2727

28+
var events = {
29+
CLICK: 'click.bellows'
30+
};
31+
2832
function Bellows(element, options) {
2933
Bellows.__super__.call(this, element, options, Bellows.DEFAULTS);
3034
}
@@ -33,7 +37,6 @@
3337

3438
Bellows.DEFAULTS = {
3539
singleItemOpen: false,
36-
event: 'click.bellow',
3740
duration: 200,
3841
easing: 'swing',
3942
open: $.noop,
@@ -55,7 +58,7 @@
5558
destroy: function() {
5659
this.$bellows
5760
.removeData(this.name)
58-
.off(this.options.event);
61+
.off(events.CLICK);
5962
},
6063

6164
_bindEvents: function() {
@@ -69,7 +72,7 @@
6972
the event from a direct child, not a bellows child from a nested bellows.
7073
*/
7174
this.$bellows
72-
.on(this.options.event, function(e) {
75+
.on(events.CLICK, function(e) {
7376
var $target = $(e.target);
7477
var $closestBellows = $target.closest('.bellows');
7578

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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
ITEM_CONTENT: '> .bellows__item > .bellows__content'
2626
};
2727

28+
var events = {
29+
CLICK: 'click.bellows'
30+
};
31+
2832
function Bellows(element, options) {
2933
Bellows.__super__.call(this, element, options, Bellows.DEFAULTS);
3034
}
@@ -33,7 +37,6 @@
3337

3438
Bellows.DEFAULTS = {
3539
singleItemOpen: false,
36-
event: 'click.bellow',
3740
duration: 200,
3841
easing: 'swing',
3942
open: $.noop,
@@ -55,7 +58,7 @@
5558
destroy: function() {
5659
this.$bellows
5760
.removeData(this.name)
58-
.off(this.options.event);
61+
.off(events.CLICK);
5962
},
6063

6164
_bindEvents: function() {
@@ -69,7 +72,7 @@
6972
the event from a direct child, not a bellows child from a nested bellows.
7073
*/
7174
this.$bellows
72-
.on(this.options.event, function(e) {
75+
.on(events.CLICK, function(e) {
7376
var $target = $(e.target);
7477
var $closestBellows = $target.closest('.bellows');
7578

0 commit comments

Comments
 (0)