mozilla

Revision 47420 of Touch events (Mozilla experimental)

  • Revision slug: DOM/Touch_events_(Mozilla_experimental)
  • Revision title: Touch events (Mozilla experimental)
  • Revision id: 47420
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 17 words added

Revision Content

{{ gecko_minversion_header("2.0") }}

{{ deprecated_header("6.0") }}

Experimental support for touch events is added in {{ Gecko("2.0") }}. These allow you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. Although touch events are based on — and work similarly to — mouse events, each event includes an identifier that allows you to track multiple fingers moving on the screen at the same time.

Note: Gecko 6 {{ geckoRelease("6.0") }} added support for W3C standard touch events. You should use those instead of this API.

Event fields

Touch events are based upon mouse events, and thereby share all mouse event fields. They include one additional field.

streamId
A unique integer identifying the finger generating the event. When the MozTouchDown event is built, a unique value is assigned to that finger. Corresponding MozTouchMove and MozTouchUp events for that finger will have the same streamId value. This lets you track each finger's movements on the touch screen independently. The stream ID is unique until the MozTouchUp event occurs; after that, the value may be recycled for another series of events.

Types of touch events

MozTouchDown

Sent when the user begins a screen touch action.

MozTouchMove

Sent when the user moves his finger on the touch screen.

MozTouchUp

Sent when the user lifts his finger off the screen.

See also

Revision Source

<p>{{ gecko_minversion_header("2.0") }}</p>
<p>{{ deprecated_header("6.0") }}</p>
<p>Experimental support for touch events is added in {{ Gecko("2.0") }}. These allow you to track the movement of the user's finger on a touch screen, monitoring the raw touch events generated by the system. Although touch events are based on — and work similarly to — mouse events, each event includes an identifier that allows you to track multiple fingers moving on the screen at the same time.</p>
<p><strong>Note:</strong> Gecko 6 {{ geckoRelease("6.0") }} added support for <a href="/en/DOM/Touch_events" title="en/DOM/Touch events">W3C standard touch events</a>. You should use those instead of this API.</p>
<h2>Event fields</h2>
<p>Touch events are based upon mouse events, and thereby share all mouse event fields. They include one additional field.</p>
<dl> <dt>streamId</dt> <dd>A unique integer identifying the finger generating the event. When the <code>MozTouchDown</code> event is built, a unique value is assigned to that finger. Corresponding <code>MozTouchMove</code> and <code>MozTouchUp</code> events for that finger will have the same streamId value. This lets you track each finger's movements on the touch screen independently. The stream ID is unique until the <code>MozTouchUp</code> event occurs; after that, the value may be recycled for another series of events.</dd>
</dl>
<h2>Types of touch events</h2>
<h3>MozTouchDown</h3>
<p>Sent when the user begins a screen touch action.</p>
<h3>MozTouchMove</h3>
<p>Sent when the user moves his finger on the touch screen.</p>
<h3>MozTouchUp</h3>
<p>Sent when the user lifts his finger off the screen.</p>
<h2>See also</h2>
<ul> <li><a href="/en/DOM/Touch_events" title="en/DOM/Touch events">Touch events</a></li> <li><a class="internal" href="/en/DOM/event" title="En/DOM/Event"><code>event</code></a></li> <li><a class="internal" href="/En/Listening_to_events" title="En/Listening to events">Listening to events</a></li>
</ul>
Revert to this revision