Java Reference
In-Depth Information
Warning: Use touchstart with Caution
Be careful when using the touchstart event as it fires as soon as a user
touches the screen. They may be touching the screen because they want to
zoom in or swipe, and a touchstart event listener could prevent them
from doing this.
The click event is often a much safer option as it still fires when the
screen is touched, but there is a slight delay of 300 ms, allowing the user
time to perform another action with the device. The click event can be
though of as a "tap" in the context of a touch event.
The touchend event occurs when a user stops touching the surface:
addEventListener("touchend", function(){
alert("Thank You");
}
The touchmove event occurs after a user has touched the screen and then moves around
without leaving. It will continue to occur as long as the user is still touching the screen,
even if they leave the element to which the event listener is attached.
The touchenter event occurs when a user has already started touching the surface, but
then passes over the element to which the event listener is attached.
The touchleave event occurs when the the user is still touching the surface, but leaves
the element to which the event listener is attached.
The touchcancel event occurs when a touch event is interrupted, such as a user's finger
moving outside the document window or too many fingers being used at once. A pop-up
dialog will also cancel a touch event.
Note: Swiping
There are no "swipe" events. These need to be created by using a combina-
tion of touchstart , touchmove , and touchleave events that mon-
itor the distance and direction moved from start to finish of a touch event.
 
Search WWH ::




Custom Search