Reputation: 538
I am running my web app on Chromium on a touch device. It's an industry control panel, not a consumer tablet.
I have a problem when the user means to click (tap) on a button, but their finger moves a little, thus causing the 'ontouchmove' event to fire. I other words, the device reads it as a swipe instead of a click.
When this happens, the click event is not fired, so nothing happens, even though the button's hover is triggered. So, the user sees that their touch was registered (button changes color), but is then frustrated by the fact that nothing happens.
I'm hoping I can put something in index.html that globally converts these swipes into standard old-fashioned clicks.
document.ontouchmove = function() {
// get target of this event
// fire the click event of that target
}
Is this even possible? I have jQuery installed. Is something like hammerjs needed? I'd like to get by with plain old JavaScript, if possible.
Thanks
Upvotes: 0
Views: 251
Reputation: 523
I'm not really sure but you can try it :
document.on("touchmove", function(e) {
$(e.target).trigger("click");
});
Upvotes: 1