Detecting that the browser has no mouse and is touch-only

前端 未结 24 1971
终归单人心
终归单人心 2020-11-27 09:35

I\'m developing a webapp (not a website with pages of interesting text) with a very different interface for touch (your finger hides the screen when you click) and mouse (re

24条回答
  •  情深已故
    2020-11-27 09:55

    Would like to recommend of a script which helped me:

    I had read and tried everything suggested, without sufficient results.

    Then I investigated some more, and found this code - device.js

    I'm using this in my client's website, to detect mouse existence:
    ( should have desktop class) and it seems pretty good, and for touch support, i just do the regular check 'ontouchend' in document and use information from both detections to assume a specific thing I need.

提交回复
热议问题