我在这个网站上有一个预加载器:http ://exit.santamartastudio.es/有时它会隐藏预加载器,有些则不会。我一直在寻找它,但不知道为什么它失败了。
更新(这是代码):
$(document).ready(function(){
setLoader();
Here I load the rest of jquery
});
$(window).load(function () {
hideloader();
});
功能:
// Setloader
function setLoader() {
disable_scroll();
$('body').css('overflow', 'hidden');
}
// Hideloader
function hideLoader() {
var windowWidth = $(window).width(); //retrieve current window width
$('#loader img').animate({
left: '+=' + ((windowWidth/2) + 100)
}, 1000, 'easeOutExpo');
$('#loader span').animate({
left: '-=' + ((windowWidth/2) + 100)
}, 1000, 'easeOutExpo');
setTimeout(function () {
$('#loader').fadeOut(800, 'linear', function(){
enable_scroll();
$('body').css('overflow', 'visible');
$(this).hide();
});
}, 200);
}