Closed utilmind closed 3 years ago
Hi @utilmind , Sorry for the late reply. I'm stick on my full-time job this days.
We use Duck Typing in detectTouch
methods —— It supports touch if this browser has document.maxTouchPoints
or window.DocumentTouch
, or window.ontouchstart
.
That gives us a pretty fast and sync way to get the support in modern browsers(Without using the single condition).
Really glad to got your advise 😁
Hello! Unfortunately tiny-swiper makes false-positive detection of false enabled device.
Tested in Windows (laptop), using latest Chrome, FireFox, Opera and Edge (honestly tested in all these browsers and all returns "2" for
navigator.maxTouchPoints
). Only IE11 returned "undefined".Here is, on my opinion, the most reliable way to detect touch enabled device. You may consider of something similar for tiny-swiper. (It's in jQuery but you can write self-destructing event handler in vanillaJS).
Or just remove
navigator.maxTouchPoints
from detectTouch().