我想问一下我目前正在尝试完成的网站问题。问题如下: 当例如index.html打开时,preloader正在加载所有元素,但侧栏菜单即使在加载期间也已出现。 有谁知道问题出在哪里?
$(window).load(function() { // makes sure the whole site is loaded
$('#status').fadeOut(); // will first fade out the loading animation
$('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
$('body').delay(350).css({'overflow':'visible'});
})

#preloader {
position: fixed;
top:0;
left:0;
right:0;
bottom:0;
background-color:#fff; /* change if the mask should be a color other than white */
z-index:99; /* makes sure it stays on top */
}
#status {
width:200px;
height:200px;
position:absolute;
left:50%; /* centers the loading animation horizontally on the screen */
top:50%; /* centers the loading animation vertically on the screen */
background-image:url(../img/status.gif); /* path to your loading animation */
background-repeat:no-repeat;
background-position:center;
margin:-100px 0 0 -100px; /* is width and height divided by two */
}

<div id="preloader">
<div id="status"> </div>
</div>
&#13;
答案 0 :(得分:0)
这里的主要问题是你指的是(从jQuery 1.8开始)deprecated .load()
method。 current method做了其他事情。
您要找的是this:
$( document ).ready(function() {
// Handler for .ready() called.
});