With the widespread use of mobile devices, support for touch screens is imperative.
Touch API has been added in H5 to support touch, including:
TouchEvent represents a touch event
Touch means a touch point
TouchList represents a set of touch points
TouchEvent is a touch event object, which has more touches, targetTouches and changedTouches properties than ordinary event objects.
Touch event types are touchstart, touchend , touchmove , touchcancel
Touch objects include identifier , screenX , clientX , pageX , target , etc., and even properties such as radiusX, rotationAngle , force, etc.
TouchList包含length、item(index)
The above basic touch events are relatively low-level and not very convenient to use, especially if you can use gestures directly in application development, it will be more efficient. In addition to some commonly used frameworks that provide touch and gesture support, there are also some script libraries. Support for touch and gestures can be provided separately, such as:
Hammer.js http://hammerjs.github.io/
Touch.js http://touch.code.baidu.com/ (from Baidu)