我一直在尝试根据我的项目要求在 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!")
}
完整来源:http://ctrlq.org/code/19616-detect-touch-screen-javascript
关于javascript - 如何在 Internet Explorer 11 上检测 Windows 8.1 中的触摸屏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27104178/