欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery實現(xiàn)的一個簡單進度條效果實例

 更新時間:2014年05月12日 09:02:45   作者:  
這篇文章主要介紹了jquery實現(xiàn)的一個簡單進度條效果實例,很好的一個入門實例,從一個方面介紹了進度的實現(xiàn)原理,需要的朋友可以參考下

jquery實現(xiàn)一個進度條的效果,或許在這里沒有什么實際的作用,但是已經(jīng)實現(xiàn)了進度條的部分原理,前端是怎么實現(xiàn)那種進度效果的。

效果演示:



進度條實現(xiàn)源碼:

復制代碼 代碼如下:

<!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>jquery實現(xiàn)進度條</title>
<style>
 .progressBar{width:200px;height:8px;border:1px solid #98AFB7;border-radius:5px;margin-top:10px;}
 #bar{width:0px;height:8px;border-radius:5px;background:#5EC4EA;}
</style>
<script type="text/jscript" src="jquery.min.js"></script>
<script type="text/javascript">
 function progressBar(){
  //初始化js進度條
  $("#bar").css("width","0px");
  //進度條的速度,越小越快
  var speed = 20;

  bar = setInterval(function(){
   nowWidth = parseInt($("#bar").width());
   //寬度要不能大于進度條的總寬度
   if(nowWidth<=200){
    barWidth = (nowWidth + 1)+"px";
    $("#bar").css("width",barWidth);
   }else{
    //進度條讀滿后,停止
    clearInterval(bar);
   } 
  },speed);
 }
</script>
</head>

<body>
 <input type="button" value="開始" onclick="progressBar()" />
 <div class="progressBar"><div id="bar"></div></div>
</body>
</html>


 

相關(guān)文章

最新評論