3
Setting:
I have a table and on the Desktop I must keep double click to access the content of each table item. On mobile devices like tablet and smart phone Double click does not work and I need to implement just one click/touch.
Code:
Checks if it’s a mobile device and keeps it by default if it’s not a double click. If you are a mobile device, use the touchend event to click. The problem is that it is not working on iPhone/iPad, when giving scroll it already triggers the event of click. Works only 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 */
});
Tested only the
'click'
instead of'touchend click';
?– Jorge Campos
@Jorgecampos Yes, I tested and it didn’t work
– João Paulo Fricks