我在加載時讓我的應用程序行爲很困難。我認爲用戶不允許他們訪問應用程序,直到它完成加載並準備好/響應。順序功能javascript
請注意:其他東西在我的應用程序中正常工作我只是不能讓函數按順序運行。
function LOADINGapp(){
//app loads but allows user to enter before loading is finished
$.when(getToday()).then(reorderdivs()).then(getSomething()).then(setupSomethingElse()).then(loadAnotherSomething()).then(INITapp());
//app stops dead at getToday but (Crome javascript console) no errors
getToday(function(){reorderdivs(function(){getSomething(function(){setupSomethingElse(function(){loadAnotherSomething(function(){INITapp();});});});});});
//app loads but allows user to enter before loading is finished
getToday(reorderdivs(),getSomething(),setupSomethingElse(),loadAnotherSomething(),INITapp());
//getToday();
//reorderdivs();
//getSomething();
//setupSomethingElse();
//loadAnotherSomething();
//INITapp();
}
function INITapp(){
$('#SPLASH').hide();
}
是否有人可以幫助我,我不明白。完成並做一個調查的基調,以使其行爲。
謝謝
我在使用callback()或loadAnotherSomething()方面沒有任何區別,我錯了嗎? –
@BenMuircroft - 你需要做的是添加一個回調參數loadAnotherSomething()等 – comp500