Wednesday, February 20, 2013

Disabling hashListening in jQuery Mobile 1.2

Just a quick note. Spending a little time today integrating Backbone.js with jQuery Mobile. Both frameworks have routing solutions which do not work together. However, there is some simple configuration that you can use to turn off the jQuery Mobile routing in favor of Backbone.js routing:
$(document).bind("mobileinit", function () {
    $.mobile.ajaxEnabled = false;
    $.mobile.linkBindingEnabled = false;
    $.mobile.hashListeningEnabled = false;
    $.mobile.pushStateEnabled = false;
});
The trick to getting this to work is loading this bit of code before you load jQuery Mobile. More information at http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html.

2 comments: