Presumedevice.js

It's true, you can't detect touch or mouse devices.
But you can make assumptions.

View on Github

Quick Demo

Try this page on different devices or simulate touch/mouse events with your favorite developer tool.

About

This is a tiny* JavaScript utility that tries to presume whatever the user is interacting with a touch and/or a mouse device.

Read more on the repository page on GitHub: https://github.com/pinoceniccola/presumedevice.js

* ~480B when compressed and gzipped.