1

I have an HTML page with a div that acts like a momentary on-off switch. It works something like this:

     $('#btn').mousedown(function() {
         startAction()
     })
     $('#btn').mouseup(function() {
         stopAction()
     })
     $('#btn').mouseout(function() {
         stopAction()
     })

This works fine in a regular web browser. But it doesn't work when I load up the page in a WebView under Android. According to this, mousedown events don't work on Android like most people expect them to; so, is there any other way to accomplish this? Basically, what I want is a notification when the user puts a finger down onto the widget, and when the finger is taken away.

I'd prefer to use JQuery, but I don't have to. I'd also prefer a solution that works on other mobile platforms.

Community
  • 1
  • 1
Mike Baranczak
  • 8,291
  • 8
  • 47
  • 71
  • The answer that I linked to has a link to the XUI library - I've just started reading the docs for that, and it actually seems like it does exactly what I want. But if anybody has a better suggestion, feel free to post it. – Mike Baranczak May 20 '11 at 19:40

1 Answers1

0

If I remember correctly, on Android, the webviews have JS disabled by default and need to be enabled. You can enable them with the document at http://developer.android.com/resources/tutorials/views/hello-webview.html

I think really, you're up to the mercy of the device and the owner as to whether or not the user has javascript enabled.

http://hubpages.com/hub/How-to-enable-disable-JavaScript-on-the-Droid-Android-phone

Hope this helps ~Kevin

Devneck
  • 144
  • 1
  • 1