summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhixin <wenzhixin2010@gmail.com>2013-08-24 23:33:53 +0800
committerzhixin <wenzhixin2010@gmail.com>2013-08-24 23:33:53 +0800
commitc66f83fa3d1d034148b65f55469fa00ffe94c3cc (patch)
treee444fad03eee4faa03dcb868a56899fbbb0ef550
parent308aa386d6f560fa2cb2a2a4c7be7ad5c84a685e (diff)
downloadmultiple-select-c66f83fa3d1d034148b65f55469fa00ffe94c3cc.zip
multiple-select-c66f83fa3d1d034148b65f55469fa00ffe94c3cc.tar.gz
multiple-select-c66f83fa3d1d034148b65f55469fa00ffe94c3cc.tar.bz2
fix #15: Only fire onClose event when the drop down is opened.
-rw-r--r--jquery.multiple.select.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js
index 7e3cd7b..9c7c150 100644
--- a/jquery.multiple.select.js
+++ b/jquery.multiple.select.js
@@ -10,8 +10,9 @@
'use strict';
function MultipleSelect($el, options) {
- var that = this;
- var elWidth = $el.width();
+ var that = this,
+ elWidth = $el.width();
+
this.$el = $el.hide();
this.options = options;
@@ -37,8 +38,9 @@
$(e.target).parents('.ms-choice')[0] === that.$choice[0]) {
return;
}
- if ($(e.target)[0] === that.$drop[0] ||
- $(e.target).parents('.ms-drop')[0] !== that.$drop[0]) {
+ if (($(e.target)[0] === that.$drop[0] ||
+ $(e.target).parents('.ms-drop')[0] !== that.$drop[0]) &&
+ that.options.isopen) {
that.close();
}
});