I have a set of Div\'s which act as buttons. These buttons have a simple jquery click() function which works in all browsers except iOS.
For example:
Based on Marek's answer this is my take on it (it's a bit cleaned up):
var ua = navigator.userAgent,
pickclick = (ua.match(/iPad/i) || ua.match(/iPhone/)) ? "touchstart" : "click";
$('.clickable_element').on(pickclick, function(e) {
// do something here
});
There's still a lot of work ahead for the industry when it comes to standards…
EDIT:
Didn't work out on Android phones. Took a more rigid approach:
if (document.documentElement.clientWidth > 1025) { pickclick = 'click' }
if (document.documentElement.clientWidth < 1025) { pickclick = 'touchstart' }
$('.clickable_element').on(pickclick, function(e) {
// do something here
});