我使用一个按钮从另一个源加载内容,在 div 中使用此
$('button').click({
$('somediv').load('source.php');
});
现在我想显示一个预加载器 div,其中包含 css 加载器;当我按下按钮时应该显示,直到 source.php 中的所有内容都加载到 div 中。谁能帮帮我???
最佳答案
使用load()
的回调:
$('button').click({
// show a loading div or something before start
$(".loading").show();
$('somediv').load('source.php', function() {
// this will be executed once 'script.php' was loaded
// hide the loading
$(".loading").hide();
});
});
关于jQuery load() 在 div 中显示 css 预加载器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37985217/