Search code examples
javascriptjquerytouchjqtouchswipe

How To detect swipe starting and ending position not touch event?


jQuery("#surface").bind("mousedown", function(e)
{
     console.log("(x,y) = (" + e.pageX + "," + e.pageY +")"); 
});

I wrote this code but not track that it is touch event or swipe event.I want to call function which fired when swipe event start and end.When you touch a finger on iPad/iPhone and push and drag to left or right.I want finger touching starting position (x,y) cordinate and need (x,y) position when you drop a finger.

I also used jqTouch but it don't give me starting and ending position.

I want to make App which swipe page according to your finger.

------------ HTML ------------

<canvas id="surface">
     //  here goes all image pages 
</canvas>

do you have any idea about how to detect swipe start and end event using jQuery or javascript but not touch event.


Solution

  • Have you looked at this plugin?

    Also, if that's not feasible, what you're gonna need to do is set a timer on touchstart and touchend

    FYI, I know jQuery plug site is broke, but you can find the download for that plugin here