leohxj
8/21/2013 - 2:52 AM

使用Modernizr检测触摸/点击事件

使用Modernizr检测触摸/点击事件

var isTouch = Modernizr.touch;
var defaults = {
    name: "range",
    tapGesture: isTouch ? "tap" : "click",
    startGesture: isTouch ? "touchstart" : "mousedown",
    moveGesture: isTouch ? "touchmove" : "mousemove",
    stopGesture: isTouch ? "touchend touchcancel" : "mouseup",
    hoverGesture: isTouch ? "touchstart" : "mouseover"
};