Skip to content

Instantly share code, notes, and snippets.

@simon-lang
Forked from anonymous/gist:4507376
Last active December 10, 2015 23:08
Show Gist options
  • Save simon-lang/4507382 to your computer and use it in GitHub Desktop.
Save simon-lang/4507382 to your computer and use it in GitHub Desktop.
// Switch active card on swipe
$(".cards").hammer().bind("swipe", function(ev) {
if (ev.direction == "left") {
if (!activeCard.is(':first-child')) {
$('.card.active').removeClass('active').next('.card').addClass('active');
}
}
else if (ev.direction == "right") {
if (!activeCard.is(':last-child')) {
$('.card.active').removeClass('active').prev('.card').addClass('active');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment