All Components

ProgressBar / API

Toggle state

Value

Indeterminate

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>API</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="box wide"> 
    <div class="box-col"> 
     <h4>Toggle state</h4> 
     <ul class="options"> 
      <li> <button class="k-button" id="enableProgressBar">Enable</button> <button class="k-button" id="disableProgressBar">Disable</button> </li> 
     </ul> 
    </div> 
    <div class="box-col"> 
     <h4>Value</h4> 
     <ul class="options"> 
      <li> <input type="text" id="newValue" value="25" class="k-textbox" placeholder="e.g. 23"> <button class="k-button" id="setProgressBarValue">Set value</button> <button class="k-button" id="getProgressBarValue">Get value</button> </li> 
     </ul> 
    </div> 
    <div class="box-col"> 
     <h4>Indeterminate</h4> 
     <ul class="options"> 
      <li> <button class="k-button" id="setIndeterminate">Set indeterminate</button> </li> 
     </ul> 
    </div> 
   </div> 
   <div class="demo-section k-content"> 
    <div id="progressBar" style="width: 100%;"></div> 
   </div> 
   <script>
        $(document).ready(function () {
            var pb = $("#progressBar").kendoProgressBar({
                min: 0,
                max: 100,
                type: "value",
                animation: {
                    duration: 400
                }
            }).data("kendoProgressBar");

            $("#setProgressBarValue").click(function () {
                pb.value($("#newValue").val());
            });

            $("#getProgressBarValue").click(function () {
                alert("Current ProgressBar value is: " + pb.value());
            });

            $("#setIndeterminate").click(function () {
                pb.value(false);
            });

            $("#enableProgressBar").click(function () {
                pb.enable();
            });

            $("#disableProgressBar").click(function () {
                pb.enable(false);
            });
        });
    </script> 
   <style>
        .box .k-textbox {
            margin: 0;
            width: 80px;
        }
        .k-button {
            min-width: 80px;
        }
    </style> 
  </div>   
 </body>
</html>