cordova - Tap/Touch events not working on Samsung Android 4.4.4 and 5 -
i developed app cordova worked fine until android 5.0. issue app can swipe cannot tap/touch specific elements within app (actually works if tap multiple times). taps work expected such buttons. other elements images etc. doesn't work (i have images in carousel when tapped executes function)
can why happening , happening on android 4.4.4 , up.
my code below
nova.touch.bindclick = function(selector, func) { if (nova.application.istouchable === false) { $(selector).click(function(e) { func.call(this, e); }); return; } var ismoving = false; var starttime = null; $(selector).bind(this.eventnames.touchstart, function(e) { ismoving = false; starttime = new date(); $(this).addclass("touching"); }); $(selector).bind(this.eventnames.touchmove, function(e) { ismoving = true; }); $(selector).bind(this.eventnames.touchend, function(e) { var $me = $(this); $me.removeclass("touching"); var duration = new date() - starttime; if (!ismoving && duration < 1000) { $me.addclass("clicking"); func.call(this, e); settimeout(function() { $me.removeclass("clicking"); }, 500); } }); };
as stated above works fine on older versions of android , versions of ios. new versions of android have problem.
i had exact same problem afternoon. i've found samsung device on android version quick in categorizing "touch move" event regular touch/"click" event.
i've found following fix solves problem.
change:
$(selector).bind(this.eventnames.touchmove, function(e) { ismoving = true; });
to:
$(selector).bind(this.eventnames.touchmove, function (e) { var duration = date.now() - starttime; if (!ismoving && duration > 1000) { ismoving = true; } });
1000ms may depending on circumstances change accordingly.
hope helps!
Comments
Post a Comment