这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

Touch() 构造函数创建新 触摸 对象。

句法

 touch = new Touch(touchInit);
					

自变量

touchInit
TouchInit 字典,拥有以下字段:
  • "identifier" , required, of type long , that is the identification number for the touch point.
  • "target" , required, of type EventTarget , the item at which the touch point started when it was first placed on the surface.
  • "clientX" , optional and defaulting to 0 , of type double , that is the horizontal position of the touch on the client window of user's screen, excluding any scroll offset.
  • "clientY" , optional and defaulting to 0 , of type double , that is the vertical position of the touch on the client window of the user's screen, excluding any scroll offset.
  • "screenX" , optional and defaulting to 0 , of type double , that is the horizontal position of the touch on the user's screen.
  • "screenY" , optional and defaulting to 0 , of type double , that is the vertical position of the touch on the user's screen.
  • "pageX" , optional and defaulting to 0 , of type double , that is the horizontal position of the touch on the client window of user's screen, including any scroll offset.
  • "pageY" , optional and defaulting to 0 , of type double , that is the vertical position of the touch on the client window of the user's screen, including any scroll offset.
  • "radiusX" , optional and defaulting to 0 , of type float , that is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated by rotationAngle, in CSS pixels of the same scale as screenX; 0 if no value is known. The value must not be negative.
  • "radiusY" , optional and defaulting to 0 , of type float , that is the the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to that indicated by rotationAngle, in CSS pixels  of the same scale as screenY; 0 if no value is known. The value must not be negative.
  • "rotationAngle" , optional and defaulting to 0 , of type float , that is the angle (in degrees) that the ellipse described by radiusX and radiusY is rotated clockwise about its center; 0 if no value is known. The value must be greater than or equal to 0 and less than 90 . If the ellipse described by radiusX and radiusY is circular, then rotationAngle has no effect. The user agent may use 0 as the value in this case, or it may use any other value in the allowed range. (For example, the user agent may use the rotationAngle value from the previous touch event, to avoid sudden changes.).
  • "force" , optional and defaulting to 0 , of type float , that is the relative value of pressure applied, in the range 0 to 1 ,其中 0 is no pressure, and 1 is the highest level of pressure the touch device is capable of sensing; 0 if no value is known. In environments where force is known, the absolute pressure represented by the force attribute, and the sensitivity in levels of pressure, may vary.

规范

规范 状态 注释
Touch Events – Level 2
The definition of 'TouchEvent' in that specification.
草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
Touch() 构造函数 Chrome 48 Edge 79 Firefox 46 IE No Opera 35 Safari No WebView Android 48 Chrome Android 48 Firefox Android 6 Opera Android Yes Safari iOS Yes Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。


另请参阅

元数据

  • 最后修改: