最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js實(shí)現(xiàn)定時(shí)進(jìn)度條完成后切換圖片

 更新時(shí)間:2017年01月04日 14:28:57   作者:東成熙就  
這篇文章主要介紹了js實(shí)現(xiàn)定時(shí)進(jìn)度條,進(jìn)度100%以后可以切換圖片,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

定時(shí)進(jìn)度條,進(jìn)度100%以后可以切換圖片等。


setInterval() setTimeout() 兩個(gè)方法都可以實(shí)現(xiàn)。

源碼:

<!DOCTYPE html> 
<html> 
<head> 
  <meta charset="utf-8"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <!-- 
  <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
  <link href="favicon.ico" rel="Bookmark" type="image/x-icon" /> 
  --> 
  <meta name="Generator" content="EditPlus®"> 
  <meta name="Author" content=""> 
  <meta name="Keywords" content=""> 
  <meta name="Description" content=""> 
  <title>Document</title> 
  <link href="" rel="stylesheet" /> 
  <style type="text/css"> 
    .progress{ 
      border:1px solid #000; 
      text-align:center; 
      height:5px; 
      width:500px; 
      margin:0 auto; 
    } 
    .progress-bar { 
      background:#000; 
      height:5px; 
 
    } 
  </style> 
  <script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script> 
</head> 
<body> 
 
<div id="" class="progress"> 
  <div id="probar" class="progress-bar"> </div> 
  <h3 align="center"></h3> 
</div> 
 
<script type="text/javascript"> 
 
/******* 
方法一,setTimout()實(shí)現(xiàn) 
***************/ 
  var p = 0; 
  var iid; 
  var runtime = 6000/100; //默認(rèn)6秒 
  function goCount(){    
    p++; 
    $("h3").html(p+'%'); 
    $(".progress-bar").css("width",p+"%"); 
    if (p == 100) 
    { 
      clearInterval(iid); 
      alert('進(jìn)度條滿了,切換下一項(xiàng)... do something'); 
    } 
  } 
  iid = setInterval(goCount,runtime); 
 
 
/******* 
方法二,setTimout()實(shí)現(xiàn) 
************* 
  var p = 0; 
  var tid; 
  var runtime = 6000/100; 
  function goCount(){   
    p++; 
    if (p <= 100) 
    { 
      //$(".progress-bar").html(p+'%'); 
      $(".progress-bar").css("width",p+"%"); 
      tid = setTimeout(goCount,runtime); 
    } else { 
      clearTimeout(tid); 
      alert('進(jìn)度條滿了,切換下一項(xiàng)...'); 
    } 
  } 
  setTimeout(goCount,runtime); 
***************/ 
</script> 
</body> 
</html> 

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

曲周县| 丹东市| 北安市| 马公市| 黑山县| 宝清县| 襄垣县| 读书| 黔西| 泾川县| 黔江区| 汶上县| 绥中县| 台东县| 城口县| 大庆市| 木里| 鄂州市| 县级市| 喀什市| 子长县| 淅川县| 万载县| 土默特右旗| 卢氏县| 辛集市| 毕节市| 双鸭山市| 朝阳县| 玉门市| 启东市| 中江县| 城市| 定远县| 南溪县| 宜兴市| 淳化县| 新疆| 怀化市| 玛沁县| 石柱|