Does the touchend not shoot after touch movement on Android 4.x?

I am writing code using Javascript, like so:

var el = document.getElementById('some-div'); el.ontouchstart = function(e){ el.innerHTML = "touch start"; }; el.ontouchend = function(e){ el.innerHTML = "touch end"; }; el.ontouchmove = function(e){ el.innerHTML = "touch moved"; }; 

This code works fine on iOS / Safari and Android 2.xx on Android 4.x (I tried 4.0.4 and 4.1), the touch does not work after the touch move. If I touch the screen without moving my finger, the touch will work.

How to fix it?

This is a Chrome bug, details here: http://code.google.com/p/chromium/issues/detail?id=152913

+7
source share
1 answer

I believe that if you call e.preventDefault () on touchstart or touchmove, this will stop the event that will be absorbed before it hits your ontouchend handler. I don't have a device here to try it right now though :)

+2
source

All Articles