最新国产好看的视频,伊人天堂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> 

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

相關(guān)文章

最新評(píng)論

隆回县| 如东县| 禹州市| 许昌县| 龙川县| 象山县| 新邵县| 墨江| 大名县| 岢岚县| 枣强县| 嵩明县| 施甸县| 衡阳市| 长治县| 天等县| 读书| 兴义市| 黑龙江省| 桦甸市| 邛崃市| 米易县| 北海市| 洛隆县| 金塔县| 收藏| 温宿县| 沙河市| 南丹县| 化隆| 黔东| 铁岭县| 大渡口区| 四子王旗| 长葛市| 扎兰屯市| 宁陕县| 凯里市| 积石山| 永安市| 杭锦后旗|