2017-08-01 121 views
1

我試過創建一個在本地機器上完美工作的預加載器。但是,在線上託管內容時,預加載器不會消失。請幫忙。以下是必需品:CSS,JS,Body預加載器不會在線淡出

#loader { 
position: absolute; 
top: 0; 
left: 0; 
right: 0; 
bottom: 0; 
background-color: #0f2338; 
z-index: 99; 
height: 100%; 
} 
#status { 
width: 200px; 
height: 200px; 
position: absolute; 
left: 50%; 
top: 50%; 
background-image: url("../png/Ball.gif"); 
background-repeat: no-repeat; 
background-position: center; 
margin: -100px 0 0 -100px; 
} 

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
script type="text/javascript"> 
    <script type="text/javascript"> 
$(window).load(function() { 
$("#status").fadeOut("slow"); 
$("#loader").delay(500).fadeOut(); 
}); 

</script> 
<body> 
<div id="loader"> 
<div id="status"></div> 
</div> 
+0

你有沒有在控制檯上的任何錯誤?您是否使用HTTPS? – DarthJDG

+0

是的,我正在使用HTTPS –

回答

1

這裏是代碼的工作代碼片段。請確保您所請求的jQuery的通過HTTPS如果您的網站被固定,使用HTTPS引用的jQuery的,而不是HTTP,在這種情況下

HTTP 小號://code.jquery.com/jquery-1.9。 1.min.js

$(window).load(function() { 
 
$("#status").fadeOut("slow"); 
 
$("#loader").delay(500).fadeOut(); 
 
});
#loader { 
 
position: absolute; 
 
top: 0; 
 
left: 0; 
 
right: 0; 
 
bottom: 0; 
 
background-color: #0f2338; 
 
z-index: 99; 
 
height: 100%; 
 
} 
 
#status { 
 
width: 200px; 
 
height: 200px; 
 
position: absolute; 
 
left: 50%; 
 
top: 50%; 
 
background-image: url("https://www.google.ca/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"); 
 
background-repeat: no-repeat; 
 
background-position: center; 
 
margin: -100px 0 0 -100px; 
 
}
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> 
 

 
<body> 
 
<div id="loader"> 
 
<div id="status"></div> 
 
</div>

+0

該腳本(對於jQuery)不會在腦海裏? –

+0

當然最好把它放在,SO代碼片段就是一個例子。根本原因是協議被用來引用jquery。 –

+0

那就是我的代碼無論如何,它不工作在線! –

相關問題