我在我的网站上使用图片幻灯片放映,但是当我加载我的网站时,它需要更多的时间,而且最初的页面一张一张图片看起来并不好。所以,我想在图像幻灯片上加载第一个加载图像,当 div 内容完全加载时,然后隐藏加载图像并显示图像幻灯片放映。所以,这怎么可能请帮助我。 我没有从 ajax 加载内容。加载很简单。
最佳答案
$('#loading-image').show(); // show loading image before request
$('#content').load('my-content-source.php', function() { // load content
$('#loading-image').hide(); // hide image after content was loaded
});
其中 loading-image
是您的加载指示器的 ID,content
是您的内容容器的 ID。
关于jquery - 显示加载图像,直到内容完全加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7499805/