方法一:
判斷是否支持觸屏:
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";
}