0

在我的应用程序中,在初始登录屏幕之后加载下一页有相当长的延迟。

在我的 iOS 应用程序中,我能够在 pagebeforeshow 事件中启动一个活动指示器,这样用户就可以知道应用程序正在加载,而不仅仅是一个空白屏幕。如下

$(document).on("pagebeforeshow", "#mainScreen", function() 
{ 

$('body').addClass('ui-loading'); 
$.mobile.loading("show", { 
text:"Loading", 
textVisible: $.mobile.loader.prototype.options.text, 
theme: $.mobile.loader.prototype.options.theme, 
}); 
}); 

$(document).on("pageshow", "#mainScreen", function() 
{ 
$('body').removeClass('ui-loading'); 
}); 

我在 android 设备上显示微调器时遇到问题。我已经在 pagebeforeshow 事件中运行了带有警报的应用程序,所以我知道它已被触发,但我不知道为什么它不会显示

4

1 回答 1

0

为什么不使用 ajaxStart 事件?

$(document).ajaxStart(function() {
    $.mobile.loading('show');
});

$(document).ajaxStop(function() {
    $.mobile.loading('hide');
});
于 2015-05-29T09:41:14.727 回答