Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created January 11, 2013 02:11
Show Gist options
  • Save jaseflow/4507388 to your computer and use it in GitHub Desktop.
Save jaseflow/4507388 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