2012-06-22 185 views

回答

0
$(document).live('pagebeforehide', function(){ 
    $.mobile.showPageLoadingMsg(); 
    //More stuff to do 
}); 

$(document).live('pageshow', function(){ 
    //More stuff to do 
    $.mobile.hidePageLoadingMsg(); 
}); 
+0

I'got這種錯誤,那麼我推出了這款soliution「遺漏的類型錯誤:對象#沒有方法'hidePageLoading'「 –

+0

糾正了API名稱。 –

+0

[http://jsfiddle.net/b39xH/4/](http://jsfiddle.net/b39xH/4/)< - 不起作用 –

0

尼爾默爾的答案不爲我工作,但結合到各個頁面的功能:

$("div[data-role='page']").live('pagebeforehide', function(){ 
    console.log("showing...."); 
    $.mobile.showPageLoadingMsg(); 
    //More stuff to do 
}); 

$("div[data-role='page']").live('pageshow', function(){ 
    //More stuff to do 
    console.log("hiding...."); 
    $.mobile.hidePageLoadingMsg(); 
}); 

jsFiddle - look at the logs, sometimes it's too fast to see