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

查看:53
本文介绍了在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);

因此,在点击它时将其称为:

So on tap it calls this:

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天全站免登陆