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 u开发者_开发技巧se JQuery, but I don't have to. I'd also prefer a solution that works on other mobile platforms.
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
精彩评论