我一直在尝试根据我的项目要求特别是在IE 10/11上检测Windows 8.1中的触摸屏...
我曾尝试过Modernizer.touch,但在IE(触摸屏)上却越来越虚假。
可以用navigator
吗?
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
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句