List.js trigger doubleclick event on touchend if selection was not changed

this allows list navigation for mobile devices that have not double click.
tested on Android 4 in Chrome, Firefox and Android Browser
This commit is contained in:
j 2013-05-14 17:12:44 +00:00
parent cdd29f1a4b
commit 697edd72a3

View file

@ -118,7 +118,8 @@ Ox.List = function(options, self) {
updateSort();
}
})
.scroll(scroll);
.scroll(scroll),
touchSelection = [];
self.options.sort = self.options.sort.map(function(sort) {
return Ox.isString(sort) ? {
@ -141,6 +142,15 @@ Ox.List = function(options, self) {
mousedown: mousedown,
singleclick: singleclick,
doubleclick: doubleclick
}).on({
touchend: function(e) {
if(touchSelection.length && that.options('selected')[0] == touchSelection[0]) {
doubleclick(e);
} else {
touchSelection = Ox.clone(that.options('selected'));
}
}
});
if (self.options.draggable) {
that.$content.bindEvent({