無輸入的全寬滑塊



說明

你可以隱藏數字輸入並使用自定義 CSS 使滑塊變為全寬

示例

以下示例演示了 jQuery Mobile 中全寬滑塊的使用。

<!DOCTYPE html>
<html>
   <head>
      <title>Full Width Slider With No Input</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>
      
      <style>
         .full-width-slider input {display: none;}
         .full-width-slider .ui-slider-track {margin-left: 10px;}
      </style>
   </head>
   
   <body>
      
      <form class = "full-width-slider">
         <label for = "slider1" class = "ui-hidden-accessible">Slider:</label>
         <input type = "range" name = "slider1" id = "slider1" min = "0" max = "100" 
            value = "60">
      </form>
      
   </body>
</html>

輸出

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

  • 將上述 html 程式碼儲存在伺服器根目錄的slider_fullwidth.html 檔案中。

  • 將此 HTML 檔案開啟為 https:///slider_fullwidth.html,即會顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.