Tutorial: Single swipe

Single swipe

touchSwipe Fork me on GitHub

events: swipeLeft, swipeRight, swipeUp, swipeDown, swipe

By using just one handler swipeLeft you can detect ONLY left swipes. There are handlers for each direction, as well as the generic swipe handler.

    $(function() {      
      //Keep track of how many swipes
      var count=0;
      //Enable swiping...
      $("#test").swipe( {
        //Single swipe handler for left swipes
        swipeLeft:function(event, direction, distance, duration, fingerCount) {
          $(this).text("You swiped " + direction + " " + ++count + " times " );  
        },
        //Default is 75px, set to 0 for demo so any distance triggers swipe
        threshold:0
      });
    });
  
I only swipe left