leohxj
8/21/2013 - 2:55 AM

原生JS判断是否支持触摸屏

原生JS判断是否支持触摸屏

var SupportsTouches = ("createTouch" in document);
var default = {
    StartEvent : SupportsTouches ? "touchstart" : "mousedown",//支持触摸式使用相应的事件替代
    MoveEvent : SupportsTouches ? "touchmove" : "mousemove",
    EndEvent : SupportsTouches ? "touchend" : "mouseup"
}