make touch device events work on buttons (closes foodcoop-rostock/foodsoft#34, closes foodcoops/foodsoft#104)
This commit is contained in:
parent
8141ad0233
commit
ac62dcce9d
1 changed files with 14 additions and 1 deletions
|
@ -10,6 +10,19 @@
|
||||||
//= require_self
|
//= require_self
|
||||||
//= require ordering
|
//= require ordering
|
||||||
|
|
||||||
|
// allow touch devices to work on click events
|
||||||
|
// http://stackoverflow.com/a/16221066
|
||||||
|
$.fn.extend({ _on: (function(){ return $.fn.on; })() });
|
||||||
|
$.fn.extend({
|
||||||
|
on: (function(){
|
||||||
|
var isTouchSupported = 'ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch;
|
||||||
|
return function( types, selector, data, fn, one ) {
|
||||||
|
if (typeof types == 'string' && isTouchSupported && !(types.match(/touch/gi))) types = types.replace(/click/gi, 'touchstart');
|
||||||
|
return this._on( types, selector, data, fn);
|
||||||
|
};
|
||||||
|
}()),
|
||||||
|
});
|
||||||
|
|
||||||
// Load following statements, when DOM is ready
|
// Load following statements, when DOM is ready
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
@ -118,4 +131,4 @@ function highlightRow(checkbox) {
|
||||||
// There must be a hidden field with the id 'hidden_field'
|
// There must be a hidden field with the id 'hidden_field'
|
||||||
function setHiddenId(text, li) {
|
function setHiddenId(text, li) {
|
||||||
$('hidden_id').value = li.id;
|
$('hidden_id').value = li.id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue