Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在internet explorer 11上检测windows 8.1中的触摸屏?_Javascript_Jquery - Fatal编程技术网

Javascript 如何在internet explorer 11上检测windows 8.1中的触摸屏?

Javascript 如何在internet explorer 11上检测windows 8.1中的触摸屏?,javascript,jquery,Javascript,Jquery,我一直在尝试检测触摸屏在windows 8.1特别是在IE 10/11根据我的项目要求 我试过使用Modernizer.touch,但在IE(触摸屏)上却出现了错误。您可以使用导航器 function is_touch_device() { return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); }

我一直在尝试检测触摸屏在windows 8.1特别是在IE 10/11根据我的项目要求


我试过使用Modernizer.touch,但在IE(触摸屏)上却出现了错误。

您可以使用
导航器

function is_touch_device() {
 return (('ontouchstart' in window)
      || (navigator.MaxTouchPoints > 0)
      || (navigator.msMaxTouchPoints > 0));
}

if (is_touch_device()) {
   alert("Yay! Its touch");
}else{
   alert("Not touch!") 
}
完整资料来源: