0
我在網站加載進度條有問題。我在下面的腳本中使用進度條,但它在Web服務器www.example.com中不能正常工作,網站是在web服務器上進行的,但是問題在於當我打開網站後,進度條會在一段時間後啓動。網站內容加載,進度條
我打開網站時如何啓動進度條?
謝謝。嘗試使用,而不是
$(window).load(function(){
var width = 100,
perfData = window.performance.timing, // The PerformanceTiming interface represents timing-related performance information for the given page.
EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart),
time = parseInt((EstimatedTime/1000)%60)*100;
// Loadbar Animation
$(".loadbar").animate({
width: width + "%"
}, time);
// Loadbar Glow Animation
$(".glow").animate({
width: width + "%"
}, time);
// Percentage Increment Animation
var PercentageID = $("#precent"),
start = 0,
end = 100,
durataion = time;
animateValue(PercentageID, start, end, durataion);
function animateValue(id, start, end, duration) {
var range = end - start,
current = start,
increment = end > start? 1 : -1,
stepTime = Math.abs(Math.floor(duration/range)),
obj = $(id);
var timer = setInterval(function() {
current += increment;
$(obj).text(current + "%");
//obj.innerHTML = current;
if (current == end) {
clearInterval(timer);
}
}, stepTime);
}
// Fading Out Loadbar on Finised
setTimeout(function(){
$('.preloader-wrap').fadeOut(300);
}, time);
});
感謝它的工作............ :) –
但我也有一個網站上的圖片,它對Html內容的完美工作但是,如何使用這個圖像? –
我想你從這個[codepen](http://codepen.io/ahsanrathore/pen/MwppEB)獲得了你的代碼吧?我改了一下代碼。試試[這codepen](http://codepen.io/tobiasglaus/pen/BROvQQ)。 – petersmith