Hey! Nice module!

I was researching why taping the menu toggle button was so slow and found out it's normal thing on touch devices to make double tap, long touch etc work.

If you use touchstart event instead, you'll get nice fast responsive menu.

Old:

$("#collapsed-menu-button").unbind("click").click(function(e) {
  _this.menuToggle(this);
  e.stopPropagation();
  e.preventDefault();
});

New:

if ('ontouchstart' in document.documentElement) {
  $('#collapsed-menu-button').on('touchstart', function(e) {
    _this.menuToggle(this);
    e.stopPropagation();
    e.preventDefault();
  });
} else {
  $("#collapsed-menu-button").unbind('click').click(function(e) {
    _this.menuToggle(this);
    e.stopPropagation();
    e.preventDefault();
  });
}

More reading here:
http://floatlearning.com/2011/03/developing-better-phonegap-apps/

What kind of jQuery code I chose:
http://stackoverflow.com/questions/9390643/jquery-touchstart-event-not-w...

How to check touchstart support:
http://stackoverflow.com/questions/2915833/how-to-check-browser-for-touc...

Comments

hkirsman’s picture

Patch for the code above.

hkirsman’s picture

There was too much changes. Now the correct patch.

hkirsman’s picture

This patch also fixes submenu expansion clicks (includes both previous patches). There's probably lot more click events to be fixed though :)

hkirsman’s picture

Status: Active » Needs review
x7ian’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

Please Refer to the official Mobile Navigation Project page.
https://drupal.org/project/mobile_navigation

Checkout the 7.x-2.x Roadmap:
https://drupal.org/node/2204499

drumm’s picture

Project: » Mobile Navigation
Version: » 7.x-1.x-dev