Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 48e1674

Browse files
committed
Added "mobileinit" handler to set up options
1 parent 75cf49b commit 48e1674

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

docs/pages/Backbone-Require/js/mobile.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ require.config( {
2525
} );
2626

2727
// Includes File Dependencies
28-
require([ "jquery","backbone","routers/mobileRouter","jquerymobile" ], function( $, Backbone, Mobile ) {
29-
30-
// Prevents all anchor click handling including the addition of active button state and alternate link bluring.
31-
$.mobile.linkBindingEnabled = false;
32-
33-
// Disabling this will prevent jQuery Mobile from handling hash changes
34-
$.mobile.hashListeningEnabled = false;
35-
36-
// Instantiates a new Backbone.js Mobile Router
37-
this.router = new Mobile();
38-
28+
require([ "jquery", "backbone", "routers/mobileRouter" ], function( $, Backbone, Mobile ) {
29+
30+
$( document ).on( "mobileinit",
31+
// Set up the "mobileinit" handler before requiring jQuery Mobile's module
32+
function() {
33+
// Prevents all anchor click handling including the addition of active button state and alternate link bluring.
34+
$.mobile.linkBindingEnabled = false;
35+
36+
// Disabling this will prevent jQuery Mobile from handling hash changes
37+
$.mobile.hashListeningEnabled = false;
38+
}
39+
)
40+
41+
require( [ "jquerymobile" ], function() {
42+
// Instantiates a new Backbone.js Mobile Router
43+
this.router = new Mobile();
44+
});
3945
} );

0 commit comments

Comments
 (0)