方法一:
判断是否支持触屏:
window.onload = function(){
if(document.hasOwnProperty("ontouchstart")){
alert(浏览器支持触屏");
}else{
alert("浏览器不支持触屏");
}
}
注:此方法在google的移动端模拟器上不适用;
方法二:
if("ontouchstart" in window){
startEvt = "touchstart";
moveEvt = "touchmove";
endEvt = "touchend";
}else{
startEvt = "mousedown";
moveEvt = "mousemove";
endEvt = "mouseup";
}