如何检测用户是否正在使用 windows 平板电脑
how to detect if user is using windows tablet
我的代码在 windows 平板电脑上运行不正常。我正在使用 slick-slider 插件。如果用户使用触摸设备,则应将其停用。
我在 windows 平板电脑上检查了我的网站,而不是 "touch" class 我有 "no-touch"
这是我的代码
if( $('.no-touch').length ) {
new Slider({
element: '.theme-slider',
slide: 'div',
dots: false,
infinite: false,
arrows: true,
slidesToShow: 2,
slidesToScroll: 2,
});
}
});
我如何检测我的网站是否使用 windows-平板电脑打开
通过 javascript 您可以使用导航器对象:
var isms = navigator.platform; // win32 on mysystem
也许这对你有用:
var isTouchDevice = 'ontouchstart' in window || (navigator.msMaxTouchPoints>0);
发件人:
Detecting Windows Tablet (touch windows devices) with Jquery
没有任何直接的 API 调用来检测 Windows 是 PC 还是平板电脑。
Microsoft Surface Pro 拿在手上可以是tablet,连上鼠标放在table.
上可以是笔记本电脑
如果你用的是windows鼠标,那就是PC!如果你使用 Windows 没有鼠标,那么它就是 tablet.
没有检测用户是否连接鼠标的功能,但这里有一个解决方法:
var Mousefound = false;
function MouseActivity(e) {
window.removeEventListener('mousemove', MouseActivity, false);
Mousefound = true;
// enable your slick-slider plugin
}
window.addEventListener('mousemove', MouseActivity, false);
此代码 returns 适用于 Surface、Edge 浏览器
if (window.navigator.pointerEnabled && navigator.maxTouchPoints > 1) {
...your function goes here...
}
您应该使用 maxTouchPoints > 1,因为 chrome returns 在桌面上显示“1”。但是,触摸设备上的浏览器 returns 10
我的代码在 windows 平板电脑上运行不正常。我正在使用 slick-slider 插件。如果用户使用触摸设备,则应将其停用。 我在 windows 平板电脑上检查了我的网站,而不是 "touch" class 我有 "no-touch" 这是我的代码
if( $('.no-touch').length ) {
new Slider({
element: '.theme-slider',
slide: 'div',
dots: false,
infinite: false,
arrows: true,
slidesToShow: 2,
slidesToScroll: 2,
});
}
});
我如何检测我的网站是否使用 windows-平板电脑打开
通过 javascript 您可以使用导航器对象:
var isms = navigator.platform; // win32 on mysystem
也许这对你有用:
var isTouchDevice = 'ontouchstart' in window || (navigator.msMaxTouchPoints>0);
发件人:
Detecting Windows Tablet (touch windows devices) with Jquery
没有任何直接的 API 调用来检测 Windows 是 PC 还是平板电脑。 Microsoft Surface Pro 拿在手上可以是tablet,连上鼠标放在table.
上可以是笔记本电脑如果你用的是windows鼠标,那就是PC!如果你使用 Windows 没有鼠标,那么它就是 tablet.
没有检测用户是否连接鼠标的功能,但这里有一个解决方法:
var Mousefound = false;
function MouseActivity(e) {
window.removeEventListener('mousemove', MouseActivity, false);
Mousefound = true;
// enable your slick-slider plugin
}
window.addEventListener('mousemove', MouseActivity, false);
此代码 returns 适用于 Surface、Edge 浏览器
if (window.navigator.pointerEnabled && navigator.maxTouchPoints > 1) {
...your function goes here...
}
您应该使用 maxTouchPoints > 1,因为 chrome returns 在桌面上显示“1”。但是,触摸设备上的浏览器 returns 10