我如何检测触摸屏在jquery和隐藏div [英] How would I detect touch screens in jquery and hide a div
本文介绍了我如何检测触摸屏在jquery和隐藏div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用这段代码:
function is_touch_device() {
return !!('ontouchstart' in window) // works on most browsers
|| !!('onmsgesturechange' in window); // works on ie10
};
可检测触摸屏并隐藏一组具有相同类别的div。
to detect touch screens and hide a set of divs with the same class.
推荐答案
您只需调用函数并使用基本逻辑。
You would simply call the function and use basic logic.
if (is_touch_device()) {
$('.yourclass').hide();
}
这篇关于我如何检测触摸屏在jquery和隐藏div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文