Skip to content

Instantly share code, notes, and snippets.

Created January 11, 2013 02:08
Show Gist options
  • Save anonymous/4507376 to your computer and use it in GitHub Desktop.
Save anonymous/4507376 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')) {
// Do nothing
}
else {
$('.card.active').removeClass('active').next('.card').addClass('active');
}
}
else if (ev.direction == "right") {
if (activeCard.is(':last-child')) {
// Do nothing
}
else {
$('.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