也许我刚刚得出结论,并且每个人都知道了很长一段时间,但是事实证明,在Chrome 70中,他们做到了:
ontouch * API在桌面上默认为禁用因此,如果您在代码中依靠
文档或
窗口中 “ ontouch *”键的存在,则您的代码将不再确定在触摸设备上起作用的内容。
我遇到了错字:
var isTouchDevice = (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
当第一个条件不再成立时,第二个条件就搞砸了。 应该有
navigator.maxTouchPoints但是,例如,在
jQuery UI Touch Punch 0.2.3中 ,使用以下代码:
$.support.touch = 'ontouchend' in document;
因此,也失去了支持。