的進步,我需要一些與此類似 - >如何顯示jQuery的負載
How to show loading spinner in jQuery? ,因爲我又撥打了DIV的內容與jQuery .load()函數。
但不是顯示圖片,我想顯示進度條。所以我需要關注那個請求的進度。
可能嗎?我怎樣才能做到這一點?
的進步,我需要一些與此類似 - >如何顯示jQuery的負載
How to show loading spinner in jQuery? ,因爲我又撥打了DIV的內容與jQuery .load()函數。
但不是顯示圖片,我想顯示進度條。所以我需要關注那個請求的進度。
可能嗎?我怎樣才能做到這一點?
你給的例子只使用ajaxStart和ajaxReady,沒有任何進展。 據我所知,沒有辦法通過jQuery來阻止調用的進度。
你好DEMO
http://jsfiddle.net/5ZRfY/
==>http://jsfiddle.net/je5qchss/
這樣的事情也許。 和請看這裏:http://api.jquery.com/ajaxComplete/或http://api.jquery.com/ajaxSuccess/和http://api.jquery.com/jQuery.ajax/(有一些很好的讀取)
你總是可以把呼叫啓動和停止時,阿賈克斯成功完成!
jQuery代碼
$(document).ready(function() {
$('#progressBar').append('<div id="bar"></div>');
// percentage of completion
var progress = '100%';
// Animate the #bar div
$('#bar').animate({
width: progress
}, 400);
});
HTML
<div id='progressBar'></div>
CSS
body{
background:#f6f6f6;
}
/*Styling of progress bar container*/
#progressBar{
width:300px;/*It is important to define the width of the progress bar*/
height:40px;
padding:0px;
background:#ccc;
border:1px solid #aaa;
-moz-box-shadow: inset 0 0 3px #888;
-webkit-box-shadow: inset 0 0 3px #888;
box-shadow: inset 0 0 3px #888;
}
/*styling the progress bar*/
#bar{
background:#499aed;
height:100%;
width:0; /*sets the bar to 0*/
}
此進度條始終移動0.4秒並且沒有顯示實際負載 – vladkras
是的,我知道有沒有進步,這就是爲什麼我問,如果它是可能的。好於圖片必須足夠。 –