国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

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

2019-11-20 15:33:49
字體:
供稿:網(wǎng)友

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

效果演示:



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

復(fù)制代碼 代碼如下:

<!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)進(jì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進(jìn)度條
  $("#bar").css("width","0px");
  //進(jìn)度條的速度,越小越快
  var speed = 20;

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

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


 

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 静海县| 昌吉市| 宜川县| 三原县| 宜都市| 册亨县| 湖州市| 济阳县| 靖宇县| 永顺县| 丹棱县| 西乡县| 筠连县| 紫金县| 湟源县| 阿拉善盟| 花莲市| 孝义市| 泰兴市| 太康县| 怀集县| 乌苏市| 辰溪县| 刚察县| 石棉县| 辽阳县| 武山县| 蕉岭县| 息烽县| 土默特左旗| 石景山区| 兴宁市| 宁南县| 芦山县| 襄樊市| 南乐县| 卢湾区| 玉树县| 鸡东县| 山丹县| 玉田县|