与骨干显示加载微调jquerymobile [英] jquerymobile with backbone showing loading spinner
问题描述
我使用jQuery移动与骨干
I am using jQuery mobile with backbone
我已经禁用了jQuery Mobile的路由和使用主干,所有工作得很好。
I have disabled the jquery mobile routing and use backbones which all works well
下面是配置
define(['jquery'], function($){
$(document).bind("mobileinit", function () {
$.mobile.ajaxEnabled = false;
$.mobile.linkBindingEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
// Remove page from DOM when it's being replaced
$('div[data-role="page"]').live('pagehide', function (event, ui) {
$(event.currentTarget).remove();
});
});
});
然后我对我的看法我用这个code Ajax调用
then on my ajax calls for my views I use this code
$.ajax({
beforeSend: function() { $.mobile.showPageLoadingMsg(); },
url: this.template,
dataType: 'html',
async: false,
success: function(data) {
compiled = _.template(data);
$.mobile.hidePageLoadingMsg();
}
});
这显示了Firefox中加载不错,但在Chrome或我的iOS设备无法正常工作?
This shows the loader fine in firefox but does not work on chrome or my ios device?
谁能帮助?
感谢
推荐答案
WebKit浏览器如Chrome / Safari浏览器/安卓/ iOS的有JQM和异步一个问题:假Ajax调用。而Ajax调用处理它们将被锁定。火狐没有这样的问题,无论出于何种原因。
Webkit browsers like Chrome/safari/android/iOS have a problem with jQM and async: false ajax call. They will get locked while ajax call is processing. Firefox don't have such problem, for whatever reason.
修改
async: false,
到
async: true,
如果异步:假的就是你的应用程序的功能至关重要,要prevent用户交互,而阿贾克斯工作,在显示整个应用程序透明DIV覆盖。做它在beforesend状态,并在成功或失败的状态中删除。
If async: false is crucial to you app functionality and you want to prevent user interaction while ajax is working, display a transparent div overlay over whole app. Do it in beforesend state and remove it in a success or a failure state.
这篇关于与骨干显示加载微调jquerymobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!