Last active
August 29, 2015 14:07
-
-
Save nblenke/46b4ec5305ea89fbb7ad to your computer and use it in GitHub Desktop.
tapping
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 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