Fix chosen touch events handler to get it working for both iOS and Android

This commit is contained in:
Hadi Nategh 2016-07-15 15:36:36 +02:00
parent 8256b99443
commit 0e74579426

View File

@ -433,7 +433,19 @@
} }
return true; return true;
}; };
AbstractChosen.prototype.search_results_touchstart = function(evt) {
this.touch_started = true;
};
AbstractChosen.prototype.search_results_touchmove = function(evt) {
this.touch_started = false;
};
AbstractChosen.prototype.search_results_touchend = function(evt) {
if (this.touch_started) {
return this.search_results_mouseup(evt);
}
};
AbstractChosen.default_multiple_text = "Select Some Options"; AbstractChosen.default_multiple_text = "Select Some Options";
AbstractChosen.default_single_text = "Select an Option"; AbstractChosen.default_single_text = "Select an Option";
@ -566,11 +578,6 @@
}); });
this.container.bind('touchstart', function(evt) { this.container.bind('touchstart', function(evt) {
_this.container_mousedown(evt); _this.container_mousedown(evt);
return evt.preventDefault();
});
this.container.bind('touchend', function(evt) {
_this.mouse_leave(evt);
return evt.preventDefault();
}); });
this.search_results.mouseup(function(evt) { this.search_results.mouseup(function(evt) {
_this.search_results_mouseup(evt); _this.search_results_mouseup(evt);
@ -582,10 +589,13 @@
_this.search_results_mouseout(evt); _this.search_results_mouseout(evt);
}); });
this.search_results.bind('touchstart', function(evt) { this.search_results.bind('touchstart', function(evt) {
_this.search_results_mouseover(evt); _this.search_results_touchstart(evt);
});
this.search_results.bind('touchmove', function(evt) {
_this.search_results_touchmove(evt);
}); });
this.search_results.bind('touchend', function(evt) { this.search_results.bind('touchend', function(evt) {
_this.search_results_mouseup(evt); _this.search_results_touchend(evt);
}); });
this.search_results.bind('mousewheel DOMMouseScroll', function(evt) { this.search_results.bind('mousewheel DOMMouseScroll', function(evt) {
_this.search_results_mousewheel(evt); _this.search_results_mousewheel(evt);