I'm using the lines like:

$.mobile.loading('show');

and

$.mobile.loading('hide');

with jquery.mobile-1.2.0.js.

It works in Firefox, but not in Chrome(Version 26) and Safari(5.1.7) on Windows. Is it browser specific?

有帮助吗?

解决方案

jQuery Moible has a problem with web-kit browsers, so if any page event (except pageshow) is used, ajax loader will only work if executed with setinterval:

Here's a working example: http://jsfiddle.net/LW7MU/

$(document).on('pagebeforeshow', '#index', function(){  
    var loader = setInterval(function(){
        $.mobile.loading('show');
        clearInterval(loader);
    },1);       
});

As I have mentioned earlier ajax loader will be successfully shown in Chrome and Safari ig pageshow event is used, example: http://jsfiddle.net/8ay3W/1/

This code can also be safely used in Firefox and mobile browsers.

This was specific to Chrome and Safari from the first jQM version, no matter using the old version of alax loader triggering or this new one with $.mobile.loading('show').

There are few other similar problems. This is also the only way jQM popup can be programatically turned on/off.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top