我問如果Phonegap應用程序能夠識別JavaScript中的swipeLeft和SwipeRight相關事件。phonegap:是否有可能從Javascript檢測swipeLeft和SwipeRight觸摸?
8
A
回答
4
0
的Zepto有swipeLeft和swipeRight觸摸事件,和其他許多人:http://zeptojs.com/#Touch%20events
5
的PhoneGap不給你了觸摸事件比你,否則與普通的移動網站獲得。即它只是包裝一個UIWebView(在iOS上)或任何其他平臺上的等價物。在移動瀏覽器
觸摸事件包括touchstart
,touchend
,touchmove
等
有沒有任何花哨的刷卡事件,或雙擊事件,或像在移動瀏覽器本身實現什麼。
但是你可以通過結合使用JavaScript和股票touchstart
,touchend
事件等模擬那些更復雜的事件
幸運的是,你並不需要,因爲幾乎所有的移動框架已經這樣做了,打擾自己寫的那些事件爲你。其他人提到了一些處理觸摸事件的庫。
我自己,我傾向於使用jQuery Mobile,其中包含swipeleft
和swiperight
事件以及其他事件。
http://jquerymobile.com/demos/1.2.0/docs/api/events.html
你甚至不必使用完整的jQuery Mobile框架,如果你不想。如果需要,您可以只包含觸摸事件處理程序。
2
使用this其工作在ios和Android與phonegap。
$("#test").swipe({
click:function(event, target) {
log("click from callback");
},
swipe:function(event, direction, distance, duration, fingerCount) {
log("swipe from callback");
},
swipeLeft:function(event, distance, duration, fingerCount) {
log("swipeLeft from callback");
},
swipeRight:function(event, distance, duration, fingerCount) {
log("swipeRight from callback");
},
swipeUp:function(event, distance, duration, fingerCount) {
log("swipeUp from callback");
},
swipeDown:function(event, distance, duration, fingerCount) {
log("swipeDown from callback");
},
swipeStatus:function(event, phase, direction, distance, duration, fingers) {
log("swipeStatus from callback");
},
pinchIn:function(event, direction, distance, duration, fingerCount, pinchZoom) {
log("pinchIn from callback");
},
pinchOut:function(event, direction, distance, duration, fingerCount, pinchZoom) {
log("pinchOut from callback");
},
pinchStatus:function(event, phase, direction, distance , duration , fingerCount, pinchZoom) {
log("pinchStatus from callback");
},
fingers:$.fn.swipe.fingers.ALL
});
0
用於刷卡優秀jQuery插件TouchSwipe-Jquery-Plugin
相關問題
- 1. jQuery swipeleft和swiperight
- 2. jQuery Mobile swipeleft和swiperight不是很響應
- 3. phonegap:是否有可能檢測到從Javascript中雙擊滑動?
- 4. 是否有可能檢測UIButton何時被觸摸?
- 5. jQuery Mobile的:Swipeleft/Swiperight是跳躍本身
- 6. 是否可以檢測Magic Mouse/Trackpad是否被觸摸?
- 7. 如何實現swipeRight和swipeLeft事件在javascript
- 8. jquery mobile:「swipeleft」和「swiperight」只能工作一次
- 9. 檢測屏幕是否被觸摸
- 10. 在swipeleft/swiperight上更改頁面
- 11. 滑動,swipeleft,swiperight事件不會在圖像上觸發
- 12. 在jquery mobile的垂直滾動期間觸發的swipeleft/swiperight
- 13. javascript(或Django/Python):檢測是否觸摸屏
- 14. UITableViewController和檢測觸摸
- 15. 是否可以檢測按鈕的觸摸?
- 16. 如何使用phonegap檢測網絡是否可接觸(1.8.0)
- 17. 檢測是否可以從JavaScript
- 18. 檢測觸摸是否在移動UIImageView從視圖控制器
- 19. 可可觸摸 - 檢測動作?
- 20. 可能檢測按鈕發件人是否來自觸摸內部與觸摸外部?
- 21. 如何檢測是否有子節點被觸摸:Sprite Kit
- 22. 如何檢測設備是否在Titanium中有觸摸屏?
- 23. 檢測Windows 8商店應用是否具有觸摸屏
- 24. 觸摸不檢測?
- 25. android檢測觸摸
- 26. android檢測觸摸
- 27. 檢測CAShapeLayer觸摸
- 28. 檢測觸摸UIButton
- 29. UINavigationItem:檢測觸摸
- 30. 是否有可能檢測到Java中是否有類可用?
您在使用任何類型的框架或插件刷卡行爲的特點? – zvona
我正在使用HTML5,Javascript和css3來製作Android中的phonegap應用程序 – Gaurav
[在iPhone和Android上檢測通過JavaScript的手指滑動]可能的重複(http://stackoverflow.com/questions/2264072/detect-a-手指輕掃通過JavaScript的iPhone和Android) – givanse