First off, your code doesn't do anything.
- $('#no-tap-delay').on('tap',
function() {
-
var $self = $(this);
-
- });
You need to actually do something on line 3. I'd suggest
logging to the console for now:
console.log('I was tapped');
As well, you're trying too hard - you don't need your
touchstart/touchend code. And it won't work on all browsers. IF
your code worked, it would only work on those browsers with touchscreen
AND that use
touchstart
/
touchend.
That leaves out Microsoft
browsers and all desktop browsers.
$('#no-tap-delay').on('vclick',
function() {
console.log('I was tapped');
});
This will work on all browsers.
If you want faster yet, you can use vmousedown. It will fire
on first touch, or start of click, rather than when the user lifts
their finger or end of click.
BTW, most current-version devices have eliminated the 300mSec
delay in most cases, so this is largely a non-issue for users with
updated OSs. What device/OS/version are you using? I've started
a new project, and haven't bothered using vclick/vmousedown as I have in
the past.