1

I'm in search of something that I can use to detect up/down, left/right swipes on android, apple and windows tablets.

So far I've come across some really good ones that work on android/apple (discussed here Detect a finger swipe through JavaScript on the iPhone and Android)

They mention that jQueryMobile and Hammer.js have issues with Android but that can be fixed with changing thresholds mentioned later in that discussion.

I found another discussion mentioning that jQueryMobile can be used with Cordova but needs "some special shim" to make it work, but I'm not experienced enough to know how that would work.

Does anyone know of other options that could be used and is compatible with all 3 platforms mentioned?

(We're using Node.js, durandel, knockout and a few others, not angular or xamarin)

Community
  • 1
  • 1
Corné
  • 125
  • 1
  • 2
  • 14

1 Answers1

2

You don't really need anything special to use jQuery Mobile with Cordova, just drop it in and follow the tutorial for creating your first JQM app and it will work. The thing about JQM, though, is that it wants to be the framework for your app, and as such you're best off developing a single page app and letting JQM handle all of the navigation. If you start mixing and matching JQM navigation with Durandal, Backbone, Angular or whathaveyou things get wonky in a hurry. I have settled on using JQM as my UI framework and Knockout to wire it up, a combo that works great for me.

As far as the gestures: I've found Hammer.js to be the most successful at running on the Android/iOS/Windows trifecta, but I've never been able to get gestures to work reliably across different devices. For example, swipe navigation might work great on a Nexus 6 running KitKat, but the same code won't work at all on an HTC One also running KitKat. And it might work great on a Surface tablet running Windows 8, but not on a Dell XPS 10 tablet running Windows 8 RT. (True stories both of these). So it's not really the platform that's the issue, it's the device itself. The approach I've settled on is to provide cool stuff like swipe navigation and pinch-to-zoom in the hope that the device will support it, but also provide an alternate means to do those things (a nav button, a zoom icon) for those that don't.

Hope this is helpful! :)

Mike Dailor
  • 1,226
  • 8
  • 16
  • Thank you, greatly appreciated. I don't have an option on whether to use Durandel so I will see how it goes – Corné Aug 14 '15 at 15:09