jQuery Mobile - 滑塊 Fieldcontain



說明

div 新增 ui-field-contain 類將確保對錶單進行響應式渲染。

示例

以下示例演示了在 jQuery Mobile 中使用 fieldcontain

<!DOCTYPE html>
<html>
   <head>
      <title>Slider Fieldcontain</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 class = "ui-field-contain">
            <label for = "slider1">Slider:</label>
            <input type = "range" name = "slider1" id = "slider1" min = "0" max = "100" 
               value = "60">
         </div>
      </form>
      
   </body>
</html>

輸出

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

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

  • 以 https:///slider_fieldcontain.html 的形式開啟此 HTML 檔案,將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.