touch事件嘛,和click事件不一样,最起码设备得支持,要是PC端使,方法全不执行咋整,所以先来个判断。
('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch
这个方法,对于支持触摸事件的浏览器,返回值是 true ,不支持的,就是 undefined 了。
京公网安备 11010502049817号