在 jQuery Mobile 1.1 中进行大量处理之前显示加载微调器? [英] Show loading spinner before heavy processing in jQuery Mobile 1.1?

查看:13
本文介绍了在 jQuery Mobile 1.1 中进行大量处理之前显示加载微调器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要出现一个微调器我快要疯了.我已经将我的繁重处理功能绑定到一个按钮上:

I'm going mad trying to get a spinner to appear. I've bound my heavy processing function to a button thus:

$(document).delegate("#clearread", "tap", onClearRead);

所以点击它称之为:

var onClearRead = function() {

setTimeout($.mobile.showPageLoadingMsg, 5);  

// Civilised cleaning of saved status
var jStorIndex = $.jStorage.index();
for (var i = 0; i < jStorIndex.length; i++) {
    if( jStorIndex[i] != "version" ) {
        $.jStorage.deleteKey(jStorIndex[i]);
    }
}   

// Load articles afresh
loadArticles();

$.mobile.changePage("#choosearticle");

} //onClearRead

我发现在清除/加载文章期间(大约 10 秒),微调器不会出现,但只会在#choosearticle 页面加载时出现一小段时间(0.5 秒).我做错了什么?

I find that the spinner does not appear during the clearing/loading of articles (about 10 secs) but only for a brief period while the #choosearticle page loads (0.5 secs). What am I doing wrong?

我让微调器在应用的其他地方工作.

I have the spinner working elsewhere in the app.

谢谢

推荐答案

试试这个:

$(document).delegate("#clearread", "tap", onClearRead);

var onClearRead = function() {
$.mobile.showPageLoadingMsg();
setTimeout(function(){  
        //Your heavy processing
        $.mobile.changePage("#choosearticle");
    }, 5);
} //onClearRead

这篇关于在 jQuery Mobile 1.1 中进行大量处理之前显示加载微调器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆