quojs 及 轉:11個處理觸摸事件和多點觸摸的JS庫
QuoJs官方文檔
http://www.360doc.com/content/15/0504/18/11984479_468037372.shtml
====
11個處理觸摸事件和多點觸摸的JS庫
摘要:觸摸屏是現在所有智能手機的標配,還包括各種平板設備,而且很多桌面也慢慢在開始支持觸摸操作。要開發支持觸摸屏設備的Web應用,我們需要借助瀏覽器的觸摸事件來實現。觸摸屏是現在所有智能手機的標配,還包括各種平板設備,而且很多桌面也慢慢在開始支持觸摸操作。要開發支持觸摸屏設備的Web應用,我們需要借助瀏覽器的觸摸事件來實現。
下圖是各種觸摸事件說明:
本文我們介紹11個用來處理觸摸事件以及支持多點觸摸的JS庫:
1.QUO JS
QuoJS是一個小型、模塊化、面向對象的JavaScript庫,用於移動Web開發中簡化HTML文檔遍歷、事件處理和Ajax交互等功能。
Events: Touch, Tap, Double tap, Hold, Fingers, Swipe, Swipe Up, Swipe Right, Swipe Down, Swipe Left, Drag
Other features: Built-in jQuery-like methods. It uses $$ to avoid conflict.
File size: 13KB minified
Standlone: Yes
2.Hammer JS
Hammer.js是一個輕量級的JavaScript庫(僅有2kb),能讓你的網站輕松實現觸控事件。它依賴於jQuery,用來控制觸摸設備上的多點觸控特性。
Events: Tap, Double tap, hold, drag, transform (pinch)
Other features: Javascript library focused only for multi-touch gestures
File size: 2KB minified
Standlone: Yes
Hammer.js已經在IOS5系統的iPad1,IOS5系統的iPhone,Android 2.3.3的三星Galaxy S以及Goolge Chrome 17測試可用。在桌面瀏覽器上鼠標能夠模擬單個手指的觸控事件。在Android 2與3默認的瀏覽器以及FireFox 10不支持多點觸控事件,所以在Android,FireFox 1.1(Nokia N900)上沒有transform。Windows Phone 7.5不支持觸摸事件,mouse event支持也很糟糕。
3.Touchy
Events: long press, drag, pinch, rotate, swipe
Other features: jQuery plugin for webkit browsers and browsers that support outch events
File size: ~2.72KB minified
Standlone: No, need jQuery framework
4.Mootools-mobile
Events: Swipe, pinch, touch hold
Other features: Touch events are separated into different files.
File size: -
Standlone: No, need MooTools
5.jQuery doubletap
Events: Touch, Swipe, Tap, Double tap, Swipe left, Swipe Right, Swipe up, Swipe down
Other features: No android support yet
File size: 4KB
Standlone: No, need jQuery
6.jGestures
Events: Orientation change, Pinch, Rotate, Swipe move, Swipe in multi direction, Swipe with 1,2,3 fingers, Tap with 1,2,3 fingers, pinch open, pinch close, shake in different directions
Other features: Bundled with many gestures and useful events
File size: 16KB minified
Standlone: No, need jQuery
7.Touch Swipe
Events: Swipes in 4 directions, 1,2 fingers touch
Other features: Allows swiping and page scrolling
File size: 25KB
Standlone: No, need jQuery
8.Touchable
Events: Tap, Long Tap, Double tap, touchable move, touchable end
Other features: Unifies touch and mouse events
File size: 1.96KB
Standlone: No, need jQuery
9.thumbs.js
Events: touch start, touch end, touch end, touch move, mouse down, mouse up, mouse move
Other features: PhoneGap and mobile web friendly
File size: 612 bytes minified
Standlone: Yes
10.jQuery.pep.js
Events: Drag
Other features: Uses CSS3 animations, built-in many drag features
File size: 16KB
Standlone: No, need jQuery
11.Jetster
Events: Tap, Double tap, Swipe, Flick, Pinch, Pinch arrow, Pinch widen, Pinch end
Other features: Jester makes recognising gestures on DOM elements really easy
File size: 25KB
Standlone: Yes
回復
quojs 及 轉:11個處理觸摸事件和多點觸摸的JS庫