我无法让这个工作:
$('#guiacategs').live('pagecreate', function(event, ui) {
$.mobile.loadingMessage = "Carregando Categorias...";
$.mobile.showPageLoadingMsg();
if(CategFornsFetched == 0) {
$.getJSON('http://www.casamentojundiai.com.br/scripts/mobile/getguiacategs.php?callback=?', function(json) {
$.each(json, function(key, val) {
$("#listaCateg").append('<li><a href="guia.html" onclick="genForns(' + val.id + ');">' + val.descricao + '</a></li>');
});
$("#listaCateg").listview('refresh');
});
CategFornsFetched = 1;
}
$.mobile.hidePageLoadingMsg();
});
但这可行,当我在之前调用停止加载时:
$('#guiacategs').live('pagecreate', function(event, ui) {
$.mobile.loadingMessage = "Carregando Categorias...";
$.mobile.showPageLoadingMsg();
$.mobile.hidePageLoadingMsg();
if(CategFornsFetched == 0) {
$.getJSON('http://www.casamentojundiai.com.br/scripts/mobile/getguiacategs.php?callback=?', function(json) {
$.each(json, function(key, val) {
$("#listaCateg").append('<li><a href="guia.html" onclick="genForns(' + val.id + ');">' + val.descricao + '</a></li>');
});
$("#listaCateg").listview('refresh');
});
CategFornsFetched = 1;
}
});
由于
答案 0 :(得分:0)
我相信将在Mobile Init
中设置页面加载消息示例:
$(document).bind("mobileinit", function(){
//apply overrides here
$.mobile.loadingMessage = "Carregando Categorias...";
});
然后您应该能够使用这些方法来显示/隐藏加载消息
示例(未测试):
$('#guiacategs').live('pagecreate', function(event, ui) {
$.mobile.showPageLoadingMsg();
if(CategFornsFetched == 0) {
$.getJSON('http://www.casamentojundiai.com.br/scripts/mobile/getguiacategs.php?callback=?', function(json) {
$.each(json, function(key, val) {
$("#listaCateg").append('<li><a href="guia.html" onclick="genForns(' + val.id + ');">' + val.descricao + '</a></li>');
});
$("#listaCateg").listview('refresh');
});
CategFornsFetched = 1;
}
$.mobile.hidePageLoadingMsg();
});