2

I am looking for a way to use the regular jquery library to catch swipe events (left, right) to redirect to a href-location specified with a particular class (default navigation. ie: .next and .previous).

<a class="next" href="http://www.">next</a>

<a class="previous" href="http://www.">previous</a>
4

1 回答 1

2
$("body").on('swipeleft', function(e) {
  window.location.replace( $(".previous").attr('href') );
});

$("body").on('swiperight', function(e) {
  window.location.replace( $(".next").attr('href') );
});

示例:http ://stephband.info/jquery.event.swipe/

于 2013-06-05T13:57:30.237 回答