aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/force_touch_events/index.html
blob: fe49550129e01a8307a78315ea8bbe63b0d368ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: Force Touch events
slug: Web/API/Force_Touch_events
translation_of: Web/API/Force_Touch_events
---
<p>{{DefaultAPISidebar("Force Touch events")}}</p>

<p>{{Non-standard_header()}}</p>

<p><strong>Force Touch events</strong> are a proprietary, Apple-specific feature which makes possible (where supported by the input hardware) new interactions based on how hard the user clicks or presses down on the touchscreen or trackpad.</p>

<h2 id="Events">Events</h2>

<dl>
 <dt>{{event("webkitmouseforcewillbegin")}} {{non-standard_inline}}</dt>
 <dd>This event is fired before the {{event("mousedown")}} event. Its main use is that it can be {{domxref("Event.preventDefault()")}}ed.</dd>
 <dt>{{event("webkitmouseforcedown")}} {{non-standard_inline}}</dt>
 <dd>This event is fired after the {{event("mousedown")}} event as soon as sufficient pressure has been applied for it to qualify as a "force click".</dd>
 <dt>{{event("webkitmouseforceup")}} {{non-standard_inline}}</dt>
 <dd>This event is fired after the {{event("webkitmouseforcedown")}} event as soon as the pressure has been reduced sufficiently to end the "force click".</dd>
 <dt>{{event("webkitmouseforcechanged")}} {{non-standard_inline}}</dt>
 <dd>This event is fired each time the amount of pressure changes. This event first fires after the {{event("mousedown")}} event and stops firing before the {{event("mouseup")}} event.</dd>
</dl>

<h2 id="Event_properties">Event properties</h2>

<p>The following property is known to be available on the {{event("webkitmouseforcewillbegin")}}, {{event("mousedown")}}, {{event("webkitmouseforcechanged")}}, {{event("webkitmouseforcedown")}}, {{event("webkitmouseforceup")}}, {{event("mousemove")}}, and {{event("mouseup")}} event objects:</p>

<dl>
 <dt><font><font>{{domxref("MouseEvent.webkitForce")}} {{non-standard_inline()}} {{readonlyinline}}</font></font></dt>
 <dd><font><font>当前施加于触控板/触摸屏的压力量</font></font></dd>
</dl>

<h2 id="常量"><font><font>常量</font></font></h2>

<p><font><font>这些常数对于确定由{{domxref("MouseEvent.webkitForce")}}指示的压力的相对强度是有用的:</font></font></p>

<dl>
 <dt><font><font>{{domxref("MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN")}} {{non-standard_inline}} {{readonlyinline}}</font></font></dt>
 <dd><font><font>正常点击所需的最小力量</font></font></dd>
 <dt><font><font>{{domxref("MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN")}} {{non-standard_inline}} {{readonlyinline}}</font></font></dt>
 <dd><font><font>强制点击所需的最小力量</font></font></dd>
</dl>

<h2 id="产品规格"><font><font>产品规格</font></font></h2>

<p><em><font><font>不是任何规格的一部分。</font></font></em><font><font>苹果</font></font><a href="https://developer.apple.com/library/prerelease/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html"><font><font>在Mac开发者图书馆</font></font></a><font><font></font><a href="https://developer.apple.com/library/prerelease/mac/documentation/AppleApplications/Conceptual/SafariJSProgTopics/RespondingtoForceTouchEventsfromJavaScript.html"><font>一个描述</font></a><font></font></font></p>