警告 : Removed in Firefox 65.

sendTouchEvent() 方法在 HTMLIFrameElement allows you to fake a touch event and send it to the browser <iframe> 's content.

注意: This method is available for touch-enabled devices only.

句法

instanceOfHTMLIframeElement.sendTouchEvent(type, x, y, rx, ry,
                                           rotationAngles, forces,
                                           count, modifiers);
					

返回

Void.

参数

type
A string representing the event type. Possible values are touchstart , touchend , touchmove ,或 touchcancel .
x
An array of numbers representing the x position of each touch point relative to the browser <iframe> 's visible area in CSS pixels.
y
An array of numbers representing the y position of each touch point relative to the browser <iframe> 's visible area in CSS pixels.
rx

An array of numbers representing the x radius of each touch point in CSS pixels.

ry

An array of numbers representing the y radius of each touch point in CSS pixels.

rotationAngles

An array of numbers representing the angle of each touch point in degrees.

forces

An array of numbers representing the intensity of each touch in the range 0–1.

count

The number of touches that should be performed.

modifiers
A number representing a key pressed at the same time the mouse button was clicked:
  • 1 : Alt
  • 2 : Ctrl
  • 4 : Shift
  • 8 : Meta
  • 16 : Alt Gr
  • 32 : Caps Lock
  • 64 : Fn
  • 128 : Num Lock
  • 256 : Scroll
  • 512 : Symbol Lock
  • 1024 : Win

注意 : You can specify multiple key modifiers separated by a pipe symbol, for example 1 | 1014 .

范例

var browser = document.querySelector('iframe');
browser.sendTouchEvent("touchstart", [1], [x], [y], [2], [2],
                       [20], [0.5], 1, 0);
					

规范

Not part of any specification.

浏览器兼容性

Supported since Firefox 47, in chrome code only. Removed completely in Firefox 65.

Unlikely ever to be supported in other browsers.

另请参阅

元数据

  • 最后修改:
  1. 方法
    1. HTMLIFrameElement.addNextPaintListener()
    2. HTMLIFrameElement.clearMatch()
    3. HTMLIFrameElement.download()
    4. HTMLIFrameElement.executeScript()
    5. HTMLIFrameElement.findAll()
    6. HTMLIFrameElement.findNext()
    7. HTMLIFrameElement.getActive()
    8. HTMLIFrameElement.getCanGoBack()
    9. HTMLIFrameElement.getCanGoForward()
    10. HTMLIFrameElement.getContentDimensions()
    11. HTMLIFrameElement.getMainfest()
    12. HTMLIFrameElement.getMuted()
    13. HTMLIFrameElement.getScreenshot()
    14. HTMLIFrameElement.getStructuredData()
    15. HTMLIFrameElement.goBack()
    16. HTMLIFrameElement.goForward()
    17. HTMLIFrameElement.getVisible()
    18. HTMLIFrameElement.getVolume()
    19. HTMLIFrameElement.mute()
    20. HTMLIFrameElement.purgeHistory()
    21. HTMLIFrameElement.reload()
    22. HTMLIFrameElement.removeNextPaintListener()
    23. HTMLIFrameElement.sendMouseEvent()
    24. HTMLIFrameElement.sendTouchEvent()
    25. HTMLIFrameElement.setActive()
    26. HTMLIFrameElement.setInputMethodActive()
    27. HTMLIFrameElement.setNFCFocus()
    28. HTMLIFrameElement.setVisible()
    29. HTMLIFrameElement.setVolume()
    30. HTMLIFrameElement.stop()
    31. HTMLIFrameElement.unmute()
    32. HTMLIFrameElement.zoom()
  2. 事件
    1. mozbrowseractivitydone
    2. mozbrowserasyncscroll
    3. mozbrowseraudioplaybackchange
    4. mozbrowsercaretstatechanged
    5. mozbrowserclose
    6. mozbrowsercontextmenu
    7. mozbrowserdocumentfirstpaint
    8. mozbrowsererror
    9. mozbrowserfindchange
    10. mozbrowserfirstpaint
    11. mozbrowsericonchange
    12. mozbrowserloadend
    13. mozbrowserloadstart
    14. mozbrowserlocationchange
    15. mozbrowsermanifestchange
    16. mozbrowsermetachange
    17. mozbrowseropensearch
    18. mozbrowseropentab
    19. mozbrowseropenwindow
    20. mozbrowserresize
    21. mozbrowserscroll
    22. mozbrowserscrollareachanged
    23. mozbrowserscrollviewchange
    24. mozbrowsersecuritychange
    25. mozbrowserselectionstatechanged
    26. mozbrowsershowmodalprompt
    27. mozbrowsertitlechange
    28. mozbrowserusernameandpasswordrequired
    29. mozbrowservisibilitychange