MENU
Touch
The Input Device Capabilities API provides information about the input devices connected to the device.
At the time of writing, this interface exposes only one property, .firesTouchEvents, which indicates whether the device is receptive to touch.
RESETRUNFULL
RESETRUNFULL
<!DOCTYPE html><html><body><script>
var inputDeviceCapabilities = new InputDeviceCapabilities();
document.write(inputDeviceCapabilities.firesTouchEvents); // true or false
</script></body></html>
TouchEvent
ev.altKey
ev.ctrlKey
ev.metaKey
ev.shiftKey
A Boolean value indicating whether respectively the alt key, the ctrl key, the meta key, or the shift key was down when the touch event was fired.
ev.touches
A TouchList of all the Touch objects representing all current points of contact with the surface, regardless of target or changed status.
ev.changedTouches
A TouchList of all the Touch objects representing individual points of contact whose states changed between the previous touch event and this one.
ev.targetTouches
A TouchList of all the Touch objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.
RESETRUNFULL
ev.altKey
ev.ctrlKey
ev.metaKey
ev.shiftKey
A Boolean value indicating whether respectively the alt key, the ctrl key, the meta key, or the shift key was down when the touch event was fired.
ev.touches
A TouchList of all the Touch objects representing all current points of contact with the surface, regardless of target or changed status.
ev.changedTouches
A TouchList of all the Touch objects representing individual points of contact whose states changed between the previous touch event and this one.
ev.targetTouches
A TouchList of all the Touch objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.
RESETRUNFULL
<!DOCTYPE html><html><body>
<canvas id="canvas" width="600" height="600" style="border:solid black 1px;">
Your browser does not support canvas element.
</canvas><script>
var el = document.getElementById("canvas");
el.addEventListener("touchstart", handleStart, false);
el.addEventListener("touchend", handleEnd, false);
el.addEventListener("touchcancel", handleCancel, false);
el.addEventListener("touchmove", handleMove, false);
function handleStart(ev){/*...*/}
function handleEnd(ev){/*...*/}
function handleCancel(ev){/*...*/}
function handleMove(ev){/*...*/}
</script></body></html>
TouchList
int length<br/>
Touch item(int index) --> []
Touch
String identifier
int screenX
int screenY
int clientX
int clientY
int pageX
int pageY
Element target
int radiusX
int radiusY
float rotationAngle (deg)
float force (0.0 to 1.0)