Skip to content

Commit

Permalink
Add double click event.
Browse files Browse the repository at this point in the history
Lets a user double click on an item to either add or remove it from the list.
  • Loading branch information
hoopla committed Sep 20, 2010
1 parent 36f4a22 commit 57a45cd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/ui.multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $.widget("ui.multiselect", {
options: {
sortable: true,
searchable: true,
doubleClickable: true,
animated: 'fast',
show: 'slideDown',
hide: 'slideUp',
Expand Down Expand Up @@ -217,6 +218,7 @@ $.widget("ui.multiselect", {
this._registerAddEvents(item.find('a.action'));
}

this._registerDoubleClickEvents(item);
this._registerHoverEvents(item);
},
// taken from John Resig's liveUpdate script
Expand Down Expand Up @@ -244,6 +246,12 @@ $.widget("ui.multiselect", {
});
}
},
_registerDoubleClickEvents: function(elements) {
if (!this.options.doubleClickable) return;
elements.dblclick(function() {
elements.find('a.action').click();
});
},
_registerHoverEvents: function(elements) {
elements.removeClass('ui-state-hover');
elements.mouseover(function() {
Expand Down

0 comments on commit 57a45cd

Please sign in to comment.