我在加载时让我的应用程序行为很困难。我认为用户不允许他们访问应用程序,直到它完成加载并准备好/响应。顺序功能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