Reputation: 13
How can i get the id of the elements under my finger during touchmove?
What i want to achieve is:
example code
var collected = [];
$('body').bind('touchstart touchmove touchend', function(event) {
event.preventDefault();
if(event.type == 'touchstart') {
collected = [];
} else if(event.type == 'touchmove') {
// id of the element under my finger??
// insert in collected the id of the element
} else if(event.type == 'touchend') {
// some code
}
});
solved.
Upvotes: 1
Views: 5246
Reputation: 5410
You can find information about all touch events in Safari here. jQuery does not have any touch event handlers, you would need to define them yourselve. Taken from this stackoverflow post
document.addEventListener('touchmove', function(e) {
e.preventDefault();
var touch = e.touches[0];
alert(touch.pageX + " - " + touch.pageY);
}, false);
This way you could define your way through all touch gestures.
Upvotes: 1