$(document).ready(function(){
$("#splash").fadeOut('6000');
$.mobile.changePage("index.html");
});
我是 jQuery 新手,希望在显示大约 5 秒后淡出带有 ID 飞溅的页面,然后将其重定向到索引页面。
我的问题是,即使我指定了时间,启动屏幕似乎也不会停留超过一秒。
最佳答案
正如您所写的那样,您的第二行不会等待第一行完成。您可以通过回调来完成此操作:
$("#splash").fadeOut('6000', function(){
$.mobile.changePage("index.html");
});
当 fadeOut 完成时执行 $.mobile.changePage("index.html");
。
关于jquery - 如何在10秒后淡出页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40248087/