触摸 Event() 构造函数创建新 TouchEvent .

句法

 event = new TouchEvent(typeArg, touchEventInit);
					

typeArg
DOMString 表示事件的名称。
touchEventInit 可选
Is a Touch EventInit 字典,拥有以下字段:
  • "touches" , optional and defaulting to [] , of type Touch[] , that is a list of objects for every point of contact currently touching the surface.
  • "targetTouches" , optional and defaulting to [], 类型 Touch[] , that is a list of objects for every point of contact that is touching the surface and started on the element that is the target of the current event.
  • "changedTouches" , optional and defaulting to [] , of type Touch[] , that is a list of objects for every point of contact which contributed to the event.
  • "ctrlKey" , optional and defaulting to false , of type 布尔 , that indicates if the ctrl key was simultaneously pressed.
  • "shiftKey" , optional and defaulting to false , of type 布尔 , that indicates if the shift key was simultaneously pressed.
  • "altKey" , optional and defaulting to false , of type 布尔 , that indicates if the alt key was simultaneously pressed.
  • "metaKey" , optional and defaulting to false , of type 布尔 , that indicates if the meta key was simultaneously pressed.

The Touch EventInit 字典还接受字段来自 UIEventInit 和来自 EventInit 字典。

浏览器兼容性

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
TouchEvent() 构造函数 Chrome 48
48
Chrome only supports the following touchEventInit 特性: touches , targetTouches , changedTouches .
Edge ≤79
≤79
Edge only supports the following touchEventInit 特性: touches , targetTouches , changedTouches .
Firefox ? IE No Opera Yes Safari No WebView Android 48
48
Chrome only supports the following touchEventInit 特性: touches , targetTouches , changedTouches .
Chrome Android 48
48
Chrome only supports the following touchEventInit 特性: touches , targetTouches , changedTouches .
Firefox Android Yes Opera Android Yes Safari iOS 3.2 Samsung Internet Android 5.0
5.0
Samsung Internet only supports the following touchEventInit 特性: touches , targetTouches , changedTouches .

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. TouchEvent
  2. 构造函数
    1. TouchEvent()
  3. 特性
    1. altKey
    2. changedTouches
    3. ctrlKey
    4. metaKey
    5. shiftKey
    6. targetTouches
    7. touches
  4. 继承:
    1. UIEvent
    2. 事件
  5. DOM 事件相关页面
    1. CompositionEvent
    2. 事件
    3. EventListener
    4. EventTarget
    5. FocusEvent
    6. InputEvent
    7. KeyboardEvent
    8. MouseEvent
    9. MouseScrollEvent
    10. MouseWheelEvent
    11. MutationEvent
    12. ProgressEvent
    13. UIEvent
    14. WheelEvent

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1