Created
February 24, 2015 19:55
-
-
Save jonkiddy/ac4a1477974e78fc1df4 to your computer and use it in GitHub Desktop.
jQuery-Mobile + Phonegap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Correct way of using JQuery-Mobile/Phonegap together? | |
// the order of declaring script matters. First include jquery, THEN THIS CODE inside a script element, then jquery mobile js | |
var deviceReadyDeferred = $.Deferred(); | |
var jqmReadyDeferred = $.Deferred(); | |
document.addEventListener("deviceReady", deviceReady, false); | |
function deviceReady() { | |
deviceReadyDeferred.resolve(); | |
} | |
$(document).on("mobileinit", function () { | |
jqmReadyDeferred.resolve(); | |
}); | |
$.when(deviceReadyDeferred, jqmReadyDeferred).then(doWhenBothFrameworksLoaded); | |
function doWhenBothFrameworksLoaded() { | |
// TBD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment