ninjasense
ninjasense

Reputation: 13856

jQuery mobile button press event slow to process

It seems like whenever I press an input button or anchor button on a mobile device, it takes a second or two to process the onclick or press event. Is there a way to speed this up?

I am using Phonegap + jQuery Mobile on an Android device, it seems to be a little faster on iOS

Upvotes: 3

Views: 7005

Answers (4)

Marcelo Amorim
Marcelo Amorim

Reputation: 1682

  • jQuery mobile is a bit buggy and slow.
  • Fast Buttons you need to control some behaviors by yourself.
  • Fastclick messed up my code.

  • Tappy is the solution in heavy-coded pages. It's lightweight and operative:

    onClick event in android webview too slow

Upvotes: 0

Dawson Loudon
Dawson Loudon

Reputation: 6029

The touchend event is pretty snappy.

$(someElement).bind('touchend',function(){
  //other code
});

Upvotes: 1

rubenlop88
rubenlop88

Reputation: 4221

From http://jquerymobile.com/demos/1.2.0/docs/pages/phonegap.html

$.mobile.buttonMarkup.hoverDelay

If you find that the button down/hover state (lists, buttons, links etc) feels sluggish the $.mobile.buttonMarkup.hoverDelay setting might be of use. It will decrease the time between the touch event and the application of the relevant class but will also result in a higher chance that the same class will be applied even when the user is scrolling (eg, over a long list of links).

For example:

$( document ).bind( "mobileinit", function() {
    $.mobile.buttonMarkup.hoverDelay = 500
});

Upvotes: 7

barry
barry

Reputation: 835

Using Fast Buttons will eliminate 300ms of the delay.

Upvotes: 3

Related Questions