mozilla

Revision 411195 of Touch events (Mozilla experimental)

  • Revision slug: Web/Guide/DOM/Events/Touch_events_(Mozilla_experimental)
  • Revision title: Touch events (Mozilla experimental)
  • Revision id: 411195
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment

Revision Content

Warning: This experimental API was removed in Gecko 18.0 {{ geckoRelease("18.0") }}, when support for the standard touch events was implemented.

The experimental touch events API described on this page was available from Gecko 2.0 {{ geckoRelease("2.0") }} to Gecko/Firefox 17. You should instead use the standard touch events API, supported since Gecko/Firefox 6 with multi-touch support added in Gecko/Firefox 12.

This API allowed 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 were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time.

Event fields

Touch events were based upon {{domxref("MouseEvent")}}, and thereby shared all mouse event fields. They included 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.

Revision Source

<div class="warning">
  <strong>Warning:</strong> This experimental API was removed in Gecko 18.0 {{ geckoRelease("18.0") }}, when support for the standard touch events was implemented.</div>
<p>The experimental touch events API described on this page was available from Gecko 2.0 {{ geckoRelease("2.0") }} to Gecko/Firefox 17. You should instead use the <a href="/en-US/docs/Web/Guide/DOM/Events/Touch_events" title="/en-US/docs/Web/Guide/DOM/Events/Touch_events">standard touch events API</a>, supported since Gecko/Firefox 6 with multi-touch support added in Gecko/Firefox 12.</p>
<p>This API allowed 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 were based on — and work similarly to — mouse events, each event included an identifier that allowed you to track multiple fingers moving on the screen at the same time.</p>
<h2 id="Event_fields">Event fields</h2>
<p>Touch events were based upon {{domxref("MouseEvent")}}, and thereby shared all mouse event fields. They included 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 id="Types_of_touch_events">Types of touch events</h2>
<dl>
  <dt>
    MozTouchDown</dt>
  <dd>
    Sent when the user begins a screen touch action.</dd>
  <dt>
    MozTouchMove</dt>
  <dd>
    Sent when the user moves his finger on the touch screen.</dd>
  <dt>
    MozTouchUp</dt>
  <dd>
    Sent when the user lifts his finger off the screen.</dd>
</dl>
Revert to this revision