Created
June 20, 2012 16:11
-
-
Save dgalarza/2960713 to your computer and use it in GitHub Desktop.
Swiping example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var start_location, end_location | |
$portfolio_modal = $('#portfolio-modal'); | |
$portfolio_modal.bind('touchstart', function(e) { | |
start_location = e.originalEvent.targetTouches[0].pageX; | |
return end_location = 0; | |
}); | |
$portfolio_modal.bind('touchmove', function(e) { | |
return end_location = e.originalEvent.targetTouches[0].pageX - start_location; | |
}); | |
$portfolio_modal.bind('touchend', function(e) { | |
if (Math.abs(end_location) < 200) return; | |
if (end_location > 0) { | |
return prev_item(); | |
} else { | |
return next_item(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment