Open kenirwin opened 6 years ago
I used the following that worked for me:
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
deviceEventType = 'touchstart'
} else {
//If its not a mobile device use 'click'
deviceEventType = 'click'
}
Thank you for this! Just solved the same problem for me.
I've working with Datamaps, and I just went to go test my code on an iPhone for the first time. I'm finding that clicking on a country on a mobile device is treated as a "hover" event -- highlighting the country but not triggering my on('click') jQuery events.
Example: http://www6.wittenberg.edu/lib/ken/datavis/datamaps/jquery.php
Clicking on a country in a desktop browser displays the country name in the "placeholder" div below the map. Doing so on my phone results only in highlighting the country and giving the mouseover text.
Is there some other event that has to be added to support mobile devices?
Thanks