Scenario:
I have a table and on the Desktop should I double-click to access the contents of each table item. On mobile devices like tablet and smarthphone double clicking does not work and you need to implement just one click / touch.
Code:
Verifies that it is a mobile device and holds it by default if it is not double clicked. If it is a mobile device uses the touchend event to click. The problem is that it is not working on the iPhone / iPad , when scrolling it already triggers the click event. Only works on Android devices.
Any suggestions?
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
var clickEvent = 'dblclick';
if(isMobile) {
clickEvent = 'touchend click';
}
$(document).on(clickEvent, '.class', function() {
/* faz alguma coisa */
});