Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect finger drag using Javascript on touch phones?

Is there a way to detect finger drags using Javascript on touch phones? I'm currently using jQuery and the mousemove() method doesn't appear to work on my Andorid phone.

EDIT: I suppose I should clarify that this is for a web application.

EDIT 2: I found a duplicate of my question a few moments ago: Detect a finger swipe through JavaScript on the iPhone and Android. Although, it does not have an accepted answer.

like image 728
Ivan Avatar asked Sep 02 '11 17:09

Ivan


1 Answers

Use the analogous touch events: touchstart, touchmove, touchcancel, and touchend. To bind an event listener for one of these events, you'll have to use, for example .bind('touchmove', ...) instead of .touchmove(...), because jQuery does not provide convenience methods.

like image 66
Matt Ball Avatar answered Oct 20 '22 15:10

Matt Ball