Reputation: 2699
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>
Upvotes: 2
Views: 1745
Reputation: 4530
$("body").on('swipeleft', function(e) {
window.location.replace( $(".previous").attr('href') );
});
$("body").on('swiperight', function(e) {
window.location.replace( $(".next").attr('href') );
});
Example: http://stephband.info/jquery.event.swipe/
Upvotes: 2