Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5/android touchcancel

Tags:

html

android

I try to work on an interface on html5 for mobile. i try to follow a mouvement, with touchstart/touchmove/touchend/touchcancel. but when i try to follow a mouvement i allways quikly have au 'touchcancel' and no more touchmove then...

when i try this : http://miniapps.co.uk/code/touchcancel/ it work perfectly, i do not have any problem.

But i think the problem come from the mouvement of the web browser that interfering with my canvas. Do you know can i fix this ?

// I try to explain more : - Here is my test code : http://frys.free.fr/mNaissance/test.html it's the "Jigsaw" puzzle code that i try to make working with a mobile. I had a "log" div hunder the text. And when i do "touchmove" on the grey canvas i have very fast a 'touchcancel' and no anymore 'touchmove' Is it more clear ? sorry for my poor english !

Thanks for help

like image 583
user972506 Avatar asked Apr 28 '12 21:04

user972506


1 Answers

I believe I found out the reason for this - Android browser (as well as Chrome for Android 4.0+) believes you are trying to scroll, so it fires the touchcancel event. What you should do is

event.preventDefault();

on touchmove event you are capturing.

like image 194
Corkscreewe Avatar answered Oct 06 '22 17:10

Corkscreewe