Reputation: 570
I'd like to swipe a div to the left with jQuery.
I have tried with the swipe method of jQuery Mobile, but I want to really move the div to the left, like the native swipe function of iOS. Can this be done?
Upvotes: 0
Views: 273
Reputation: 89
Core jQuery doesn't have anything special for touch events, but you can easily build your own using the following events
For example, the touchmove
document.addEventListener('touchmove', function(e) {
e.preventDefault();
var touch = e.touches[0];
alert(touch.pageX + " - " + touch.pageY);
}, false);
This works in most webkit based browsers (incl. android).
Apple documentation for handling events.
Upvotes: 1