我使用通过以下jQuery代码段加载的自定义CSS预加载程序。页面预加载程序加载到后期
问题是,它加载在一起的JavaScript,所以它需要一段时间。结果是,在第一个2-3秒内,我的页面上没有任何内容 - 没有内容,也没有预加载器。
我试图将项目中的预加载器脚本先移到项目中,以便首先加载它,但这并没有多大帮助。
如何让它立即加载,没有滞后?
<!-- Preloader -->
<script type="text/javascript">
//<![CDATA[
$(window).load(function() { // makes sure the whole site is loaded
$('#status').load("preloader/preloader.html"); // will first fade out the loading animation
$('#preloader').delay(2500).fadeOut('slow'); // will fade out the white DIV that covers the website.
$('body').delay(2500).css({
'overflow': 'visible'
});
})
//]]>
</script>
preloader.html是我的css preloader的html代码。
你的HTML中的这个脚本位于哪里? –