js代码:
console.log("ontouchstart" in window);
手机web浏览器,chrome模拟手机、手机APP会返回true,
pc端(非手机模拟状态下)返回false
所以:一种事件的处理方法:
var isTouch = ("ontouchstart" in window) ? true : false;
var touchStartEvt = isTouch ? "touchstart" : "mousedown";
var touchMoveEvt = isTouch ? "touchmove" : "mousemove";
var touchEndEvt = isTouch ? "touchend" : "mouseup";
var transitionEndEvt = vendorPrefix + "TransitionEnd";