HTML5 Element Touch Events
HTML Element
The touchstart, touchend, touchmove, touchenter, touchleave, touchcancel events must be defined on an element.
Code Example:
|
|
|
Learning Resources:
Reference - Touch API BlackBerry browser JavaScript reference guide [BlackBerry Documentation]. |
Sample - SketchPad Application Example that draws finger sketches on an HTML5 canvas corresponding to touch screen or trackpad movement [BlackBerry Developer Resource Center]. |
Supported Platform(s)
- BlackBerry OS 6.0+ |
- BlackBerry PlayBook 1.0+ |
- BlackBerry 10 |
API | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
---|---|---|---|---|---|---|---|
ontouchcancel | Y | Y | Y | Y | Y | ||
ontouchend | Y | Y | Y | Y | Y | ||
ontouchenter | Y | Y | Y | Y | Y | ||
ontouchleave | Y | Y | Y | Y | Y | ||
ontouchmove | Y | Y | Y | Y | Y | ||
ontouchstart | Y | Y | Y | Y | Y |
Configuration Document Settings
To use all of the API described for this object, you must ensure the following settings are in your configuration document: |
This API does not require a <feature> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
Permission Elements (PlayBook and BlackBerry 10+) |
---|
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
Events
void | ontouchcancel |
void | ontouchend |
void | ontouchenter |
void | ontouchleave |
void | ontouchmove |
void | ontouchstart |
Events
void
ontouchcancel
(event : TouchEvent)
A user agent must dispatch this event type to indicate when a touch point has been disrupted in an implementation-specific manner, such as a synchronous event or action originating from the UA canceling the touch, or the touch point leaving the document window into a non-document area which is capable of handling user interactions. (e.g. The UA's native user interface, plug-ins) A user agent may also dispatch this event type when the user places more touch points on the touch surface than the device or implementation is configured to store, in which case the earliest Touch object in the TouchList should be removed.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |
void
ontouchend
(event : TouchEvent)
A user agent must dispatch this event type to indicate when the user removes a touch point
from the touch surface, also including cases where the touch point physically leaves the
touch surface, such as being dragged off of the screen.
The target of this event must be the same Element that received the touchstart event when
this touch point was placed on the surface, even if the touch point has since moved outside
the interactive area of the target element.
The touch point or points that were removed must be included in the changedTouches attribute
of the TouchEvent, and must not be included in the touches and targetTouches attributes.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |
void
ontouchenter
(event : TouchEvent)
A user agent must dispatch this event type to indicate when a touch point moves onto the interactive area defined by a DOM element. Events of this type must not bubble.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |
void
ontouchleave
(event : TouchEvent)
A user agent must dispatch this event type to indicate when a touch point moves off the interactive area defined by a DOM element. Events of this type must not bubble.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |
void
ontouchmove
(event : TouchEvent)
A user agent must dispatch this event type to indicate when the user moves a touch point along
the touch surface.
The target of this event must be the same Element that received the touchstart event when this
touch point was placed on the surface, even if the touch point has since moved outside the
interactive area of the target element.
If the values of radiusX, radiusY, rotationAngle, or force are known, then the user agent
also must dispatch this event type to indicate when any of these attributes of a touch point
have changed.
Note that the rate at which the user agent sends touchmove events is implementation-defined,
and may depend on hardware capabilities and other implementation details.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |
void
ontouchstart
(event : TouchEvent)
A user agent must dispatch this event type to indicate when the user places a touch point
on the touch surface.
The target of this event must be an Element.
Supported Platforms | |
---|---|
- BlackBerry OS 6.0+ | |
- BlackBerry PlayBook 1.0+ | |
- BlackBerry 10 |
Parameters | |
---|---|
event |