The only way to detect touch with JavaScript
David Gilbertson
14610

Great article, thanks. What you think about doing it this way (jQuery):

  • find out if device is touch capable
  • if yes, then add event listeners for touchstart and mouseover
  • remove event listeners when either of those are found

This way event listeners are not uset at all for devices that are not touch capable. Another option would be to use only those listeners with .one(), not sure which one would be lighter for browser.

Show your support

Clapping shows how much you appreciated Riku’s story.