diff options
author | lou <louiscuny@gmail.com> | 2013-03-23 16:46:35 +0100 |
---|---|---|
committer | lou <louiscuny@gmail.com> | 2013-04-19 11:57:53 +0200 |
commit | cb71f543a2d1a75643943bc6c66101f837decce0 (patch) | |
tree | 676e147a8b8c8bca645266b97d091016b7a624ae /js/jquery.multi-select.js | |
parent | 9cb9572d6d232e33fc157433ac35f28841705613 (diff) | |
download | multi-select-cb71f543a2d1a75643943bc6c66101f837decce0.zip multi-select-cb71f543a2d1a75643943bc6c66101f837decce0.tar.gz multi-select-cb71f543a2d1a75643943bc6c66101f837decce0.tar.bz2 |
refactor dblClick stuff
Diffstat (limited to 'js/jquery.multi-select.js')
-rw-r--r-- | js/jquery.multi-select.js | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index 95e924a..4508952 100644 --- a/js/jquery.multi-select.js +++ b/js/jquery.multi-select.js @@ -161,21 +161,14 @@ $('li', that.$container).removeClass('ms-hover'); }); - if(that.options.dblClick) { - that.$selectableUl.on('dblclick', '.ms-elem-selectable', function(){ - that.select($(this).data('ms-value')); - }); - that.$selectionUl.on('dblclick', '.ms-elem-selection', function(){ - that.deselect($(this).data('ms-value')); - }); - } else { - that.$selectableUl.on('click', '.ms-elem-selectable', function(){ - that.select($(this).data('ms-value')); - }); - that.$selectionUl.on('click', '.ms-elem-selection', function(){ - that.deselect($(this).data('ms-value')); - }); - } + var action = that.options.dblClick ? 'dblclick' : 'click'; + + that.$selectableUl.on(action, '.ms-elem-selectable', function(){ + that.select($(this).data('ms-value')); + }); + that.$selectionUl.on(action, '.ms-elem-selection', function(){ + that.deselect($(this).data('ms-value')); + }); that.$selectionUl.on('mouseenter', '.ms-elem-selection', function(){ |