我正在使用骨干和jquery移动设备来禁用jquerymobile路由。 问题是,当比较页面时,标题出现,在3秒内消失,然后重新出现。为什么呢?
我的索引html:
<html>
<head>
<meta 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" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-
1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js">
</script>
<script src="http://www.parsecdn.com/js/parse-1.2.7.min.js"></script>
<script data-main="js/main.js" src="libs/require/require-1.0.8.js"></script>
<title>Hello World</title>
</head>
<body>
<div data-role="header">
<h1>Backbone.js + jQuery Mobile</h1>
</div>
<script type="text/javascript" src="cordova-2.7.0.js"></script>
</body>
</html>
main代码,用于禁用jquerymobilerouting:
require.config({
paths: {
jQuery: '../libs/jquery/jquery-loader',
jQueryMobile: '../libs/jquery.mobile/jquery.mobile-loader',
underscore: '../libs/underscore/underscore-loader',
Backbone: '../libs/backbone/backbone-loader',
order: '../libs/require/order-1.0.5',
text: '../libs/require/text-1.0.6',
async: '../libs/require/async',
//PhoneGap: '../libs/phonegap/phonegap-loader',
Handlebars: '../libs/handlebars/Handlebars',
templates: '../templates'
}
});
require(['order!jQuery'],function($){
// jQueryMobile configuration
$(document).bind("mobileinit", function() {
$.mobile.autoInitializePage = false;
$.mobile.linkBindingEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
$.mobile.pageContainer = $("body");
// Remove page from DOM when it's being replaced, otherwise the DOM will contain all of them
$('div[data-role="page"]').on('pagehide', function(event, ui) {
$(event.currentTarget).remove();
});
});
// We launch the App
// jQueryMobile is referenced in order to start its initialization
require(['underscore', 'Backbone', 'router', 'jQueryMobile'], function(_, Backbone, AppRouter, jQueryMobile) {
document.addEventListener("deviceready", run, false);
run();
function run() {
},
app = new AppRouter();
Backbone.history.start();
}
})
});