Skip to content

Instantly share code, notes, and snippets.

@leohxj
Created August 21, 2013 02:55
Show Gist options
  • Save leohxj/6289879 to your computer and use it in GitHub Desktop.
Save leohxj/6289879 to your computer and use it in GitHub Desktop.
原生JS判断是否支持触摸屏
var SupportsTouches = ("createTouch" in document);
var default = {
StartEvent : SupportsTouches ? "touchstart" : "mousedown",//支持触摸式使用相应的事件替代
MoveEvent : SupportsTouches ? "touchmove" : "mousemove",
EndEvent : SupportsTouches ? "touchend" : "mouseup"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment