當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


jQuery UI Progressbar destroy()用法及代碼示例

jQuery UI 由 GUI 小部件、視覺效果和使用 HTML、CSS 和 jQuery 實現的主題組成。 jQuery UI 非常適合為網頁構建 UI 接口。 jQuery UI Progressbar 小部件用於添加確定或不確定進程的顯示狀態。

jQuery UI 進度條 destroy() 方法用於從小部件中完全刪除進度條函數。此方法不接受任何參數並將元素返回到其初始化前狀態。

用法:

$(".selector").progressbar( "destroy" );


CDN鏈接:首先,添加項目所需的jQuery UI腳本。

<link rel=”stylesheet” href=”//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
<script src=”//code.jquery.com/jquery-1.12.4.js”></script>
<script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>

例:此示例演示 jQuery UI Progressbar destroy() 方法。

HTML


<!doctype html>
<html lang="en">
  
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href=
"//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
    <script src=
        "//code.jquery.com/jquery-1.12.4.js">
    </script>
    <script src=
       "//code.jquery.com/ui/1.12.1/jquery-ui.js">
     </script>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
  
        <h3>jQuery UI Progressbar destroy() Method</h3>
  
        <div style="width:50%;" id="divID"></div>
  
        <input type="button" id="btn" 
               style="padding:5px 15px; margin-top:40px;" 
               value="Destroy the Widget">
    </center>
  
    <script>
        $(document).ready(function () {
            $("#divID").progressbar({
                value:false
            });
  
            $("#btn").on('click', function () {
                $("#divID").progressbar("destroy");
            });
        });
    </script>
</body>
</html>

輸出:

參考: https://api.jqueryui.com/progressbar/#method-destroy




相關用法


注:本文由純淨天空篩選整理自ppatelkap大神的英文原創作品 jQuery UI Progressbar destroy() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。