Skip to content

Instantly share code, notes, and snippets.

@nblenke
Last active August 29, 2015 14:07
Show Gist options
  • Save nblenke/46b4ec5305ea89fbb7ad to your computer and use it in GitHub Desktop.
Save nblenke/46b4ec5305ea89fbb7ad to your computer and use it in GitHub Desktop.
tapping
var tapFlag = 0,
tapping = function (ev) {
var bool = false;
if (ev.type === 'touchstart') {
tapFlag = 1;
}
if (ev.type === 'touchmove') {
tapFlag = 0;
}
if (ev.type === 'touchend') {
if (tapFlag === 1) {
bool = true;
} else if (tapFlag === 0) {
bool = false;
}
}
return bool;
};
$('.foo').on('touchstart touchmove touchend click', function (ev) {
if(tapping(ev) || ev.type === 'click') {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment