diff options
author | zhixin <wenzhixin2010@gmail.com> | 2014-04-24 22:02:31 +0800 |
---|---|---|
committer | zhixin <wenzhixin2010@gmail.com> | 2014-04-24 22:02:31 +0800 |
commit | 8da3133b83183d53d29e87c850b9811c003dd8c7 (patch) | |
tree | ec5f85d4cb2b85755276a479e7b5aabfc94f1fe2 /jquery.multiple.select.js | |
parent | 72fe6164be33d98f28497488bb6773516ff1fde8 (diff) | |
download | multiple-select-8da3133b83183d53d29e87c850b9811c003dd8c7.zip multiple-select-8da3133b83183d53d29e87c850b9811c003dd8c7.tar.gz multiple-select-8da3133b83183d53d29e87c850b9811c003dd8c7.tar.bz2 |
Fix #63: add keepOpen option.
Diffstat (limited to 'jquery.multiple.select.js')
-rw-r--r-- | jquery.multiple.select.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/jquery.multiple.select.js b/jquery.multiple.select.js index 35cde1a..0c68493 100644 --- a/jquery.multiple.select.js +++ b/jquery.multiple.select.js @@ -33,17 +33,19 @@ width: (options.width || elWidth) + 'px' }); - $('body').click(function(e) { - if ($(e.target)[0] === that.$choice[0] || + if (!this.options.keepOpen) { + $('body').click(function(e) { + if ($(e.target)[0] === that.$choice[0] || $(e.target).parents('.ms-choice')[0] === that.$choice[0]) { - return; - } - if (($(e.target)[0] === that.$drop[0] || + return; + } + if (($(e.target)[0] === that.$drop[0] || $(e.target).parents('.ms-drop')[0] !== that.$drop[0]) && that.options.isOpen) { - that.close(); - } - }); + that.close(); + } + }); + } this.selectAllName = 'name="selectAll' + name + '"'; this.selectGroupName = 'name="selectGroup' + name + '"'; @@ -448,6 +450,7 @@ maxHeight: 250, container: null, position: 'bottom', + keepOpen: false, styler: function() {return false;}, |