<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.0.css" />
<title>Hello World</title>
</head>
<body>
<div date-role="header">
<h1>Hello PhoneGap</h1>
</div>
<div date-role="content">
<h1>Content</h1>
</div>
<div date-role="footer" data-position="fixed">
<h4>Footer</h4>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.0.js"></script>
</body>
</html>
var gapReady = $.Deferred();
var jqmReady = $.Deferred();
document.addEventListener("deviceReady", deviceReady, false);
function deviceReady()
{
gapReady.resolve();
}
$(document).one("mobileinit", function(){
jqmReady.resolve();
});
$.when(gapReady, jqmReady).then(myAppLogic);
function myAppLogic()
{
alert(1);
}
我在这里找到了这个解决方案https://sszark.com/programming/deviceready-vs-mobileinit-in-phonegap-and-jquerymobile-based-app-development,但它没有用......我已经尝试过所有方法......请帮我解决这个问题!