简体   繁体   English

HTML进度条

[英]HTML Progress Bar

How would I add a progress bar to my website, that looks like the one on this website? 我如何在我的网站上添加一个进度条,看起来像这个网站上的进度条? Progress Example 进展示例

It looks like the Apple one! 它看起来像苹果一个!

<progress max="Maximum Value" value="Initial Value" />

See this for more details. 有关详细信息,请参阅

Note that this only works for browsers that support HTML5. 请注意,这仅适用于支持HTML5的浏览器。

You can use jQuery instead. 你可以使用jQuery代替。 There in no restriction of HTML5. 没有HTML5的限制。 Also you can apply styles 您也可以申请样式

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Progressbar - Custom Label</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <style>
  .progress-label {
    float: left;
    margin-left: 50%;
    margin-top: 5px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #fff;
  }
  </style>
  <script>
  $(function() {
    var progressbar = $( "#progressbar" ),
      progressLabel = $( ".progress-label" );

    progressbar.progressbar({
      value: false,
      change: function() {
        progressLabel.text( progressbar.progressbar( "value" ) + "%" );
      },
      complete: function() {
        progressLabel.text( "Complete!" );
      }
    });

    function progress() {
      var val = progressbar.progressbar( "value" ) || 0;

      progressbar.progressbar( "value", val + 1 );

      if ( val < 99 ) {
        setTimeout( progress, 100 );
      }
    }

    setTimeout( progress, 3000 );
  });
  </script>
</head>
<body>

<div id="progressbar"><div class="progress-label">Loading...</div></div>


</body>
</html>

Source code available here http://jqueryui.com/progressbar/ 源代码可在此处http://jqueryui.com/progressbar/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM