2012-01-11 33 views
2

我想知道我怎樣才能使這個作爲一個簡單的代碼,我在網站上找到了一些我想用於一個網站的工作,這個東西是我試圖把它放在我的網站(一個非常簡單的)但我不能讓它工作。 有誰知道我怎麼能讓它成爲一個簡單的代碼?如何用jquery製作進度條?

this is what u found

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>eBay PayPal</title> 
<style type="text/css"> 
*{margin:0; padding:0;} 
body{background:#FFFFFF url(images/1.jpg) top left no-repeat; width:1099px; height:1050px;} 
</style> 
<script src="http://jquery-ui.googlecode.com/svn/tags/1.7.2/jquery-1.3.2.js" type="text/javascript"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" type="text/javascript"></script> 



<script type="text/javascript"> 
$(document).ready(function(){ 
    var p=0; 
    $("#myProgressBar").progressbar({value:0}); 
     var timer = setInterval(function(){ 
      //This animates the bar 
      $("#myProgressBar .ui-progressbar-value").animate({width: p+"%"},500); 
      //This does static sets of the value 
      //$("#myProgressBar").progressbar("option","value",p); 
      p = p +33.33; 
      if(p>33.33){ 
       $("#myProgressBar .ui-progressbar-value").animate({width: "33.33%"}, 500); 
       //$("#myProgressBar").progressbar("option","value",100); 
       clearInterval(timer); 
      } 
    },500); 
}); 
</script> 

</head> 

<body> 
<a href="2.html" style="width:185px; height:31px;position:absolute; left: 198px; top: 516px;"></a> 
<div id='myProgressBar' style="position:absolute; border:1px red solid; height:41px; width:950px; left: 69px; top: 608px;"></div> 
</body> 
</html>` 

我想知道如果有人能幫助我吧,基本上我想只是一個上有一個進度條頁面。 CA

回答

2

這可能幫助:

在那裏,

http://docs.jquery.com/UI/Progressbar

有代碼的例子應該很容易讓你做出一個進度條。

+0

非常感謝你的幫助,任何機會,你有什麼想法如何動畫? – karlelizabeth 2012-01-11 06:51:13

+0

沒問題,我想這個答案會幫助你:http://stackoverflow.com/questions/5047498/how-do-you-animate-the-value-for-a-jquery-ui-progressbar。 – 2012-01-11 07:06:51

+1

你知道爲什麼我的代碼現在工作嗎? http://jsfiddle.net/gPfBC/當我嘗試使它在我的HTML文件內工作時,只是不工作! – karlelizabeth 2012-01-11 07:37:20

1

我對已經開發的progressbar概念進行了改進,它只是基於jQuery和CSS的。 看看下面的鏈接,有它的細節:

http://progressbar-simple.blogspot.com/

希望有所幫助。

+0

我在我的項目中集成了相同的進度條,但我面臨IE 10+中進度條更新的延遲。我添加了下面的語句來改善進度條的滯後性 uploadProgess.find('div')。animate({width:progressBarWidth},{queue:false,duration:100})。html(this.uploadPercentage +「%&nbsp」 ); 但它仍然有點滯後。任何其他想法來提高性能。 – sunder 2014-12-23 06:42:18