2012-01-11 96 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