jQuery Mobile - 基本範圍滑塊



說明

可以透過新增 data-role 屬性並將其設定為 rangeslider 來使用 rangeslider 小元件。

示例

以下示例演示了在 jQuery Mobile 中使用 基本範圍滑塊

<!DOCTYPE html>
<html>
   <head>
      <title>Basic Rangeslider</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
   <form>
      <div data-role = "rangeslider">
         <label for = "range-1">Rangeslider:</label>
         <input type = "range" name = "range-1" id = "range-1" min = "0" max = "100" value = "20">
         <label for = "range-2">Rangeslider:</label>
         <input type = "range" name = "range-2" id = "range-2" min = "0" max = "100" value = "60">
      </div>
      </form>
   </body>
</html>

輸出

讓我們執行以下步驟,瞭解上述程式碼如何工作−

  • 將上述 HTML 程式碼另存為 range_slider_basic.html 檔案,並將其儲存在伺服器根資料夾中。

  • 將此 HTML 檔案作為 https:///range_slider_basic.html 開啟,系統將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.