454 B
454 B
title, tags
| title | tags |
|---|---|
| supportsTouchEvents | browser,intermediate |
Returns true if touch events are supported, false otherwise.
- Check if
ontouchstartexists inwindoworwindow.DocumentTouchis true and the currentdocumentis an instance of it.
const supportsTouchEvents = () =>
window &&
('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch);
supportsTouchEvents(); // true