--- title: Touch slug: Web/API/Touch translation_of: Web/API/Touch ---
{{ APIRef("Touch Events") }}
Touch
介面表示了一個於觸控裝置上接觸的單一觸碰點。觸碰點通常是由手指或觸控筆所接觸,而裝置可能為觸控螢幕或觸控板。
{{ domxref("Touch.radiusX") }}、{{ domxref("Touch.radiusY") }} 及 {{ domxref("Touch.rotationAngle") }} 描述了使用者與螢幕之間接觸的區域—觸碰區(touch area),這對處理不精確的指向設備(如手指)來說相當有幫助。這些數值被用來描述一個盡可能與整個接觸面積相匹配的橢圓(如使用者的指尖)。{{experimental_inline}}
Note: Many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force
value will always be 0. This may also be the case for radiusX
and radiusY
; if the hardware reports only a single point, these values will be 1.
This interface has no parent, and doesn't inherits or implements any other property.
Touch
object. A given touch point (say, by a finger) will have the same identifier for the duration of its movement around the surface. This lets you ensure that you're tracking the same touch all the time.clientX
, this value includes the horizontal scroll offset, if any.clientY,
this value includes the vertical scroll offset, if any.{{SeeCompatTable}}
screenX
.screenY
.float
between 0.0
(no pressure) and 1.0
(maximum pressure).This interface has no method and no parent, and doesn't inherits or implements any method.
Specification | Status | Comment |
---|---|---|
{{SpecName('Touch Events 2', '#touch-interface', 'Touch')}} | {{Spec2('Touch Events 2')}} | Added radiusX , radiusY , rotationAngle , force properties, as well as the Touch() constructor. |
{{SpecName('Touch Events', '#touch-interface', 'Touch')}} | {{Spec2('Touch Events')}} | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | {{CompatChrome("22.0")}} | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("18.0")}}[1] {{CompatGeckoDesktop("52.0")}}[2] |
{{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
radiusX , radiusY , rotationAngle , force |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Touch() constructor |
{{CompatUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Android Webview | Chrome for Android | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("6.0")}} | {{CompatVersionUnknown}} | 11 | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
radiusX , radiusY , rotationAngle , force |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatGeckoMobile("6.0")}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Touch() constructor |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
[1] Touch events were implemented in Gecko 18.0, but removed again in 24.0 {{geckoRelease("24.0")}} on the desktop version of Firefox due to web compatibility issues ({{bug(888304)}}).
[2] As of Gecko 52.0, touch events support has been fixed and reenabled in Windows desktop platforms.