我在這個站點有一個預加載器:http://exit.santamartastudio.es/它有時會隱藏preloader,有些則不會。我一直在尋找它但不知道它爲什麼失敗。jQuery Preload不消失
UPDATE(這裏是代碼):
$(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);
}
我們可以看到您的js加載預加載器嗎? – Vortex
控制檯提供了兩個錯誤,一個是:'ReferenceError:找不到變量:hideloader'。嘗試在JavaScript的頂部使用''use strict';'以獲得最嚴格的錯誤,以便最好地回溯所有錯誤。 – 2013-03-31 10:32:31