jQuery Mobile - 尺寸微小的滑塊



描述

對於更緊湊的滑塊版本,你可以在你的 <input> 中使用 data-mini 屬性。當你想在更小的空間中顯示範圍滑塊時,它非常有用。

示例

以下示例演示了在 jQuery Mobile 中使用 尺寸微小的滑塊

<!DOCTYPE html>
<html>
   <head>
      <title>Slider Mini Sized</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>
         <label for = "slider1">Slider:</label>
         <input type = "range" name = "slider1" id = "slider1" data-mini = "true" min = "0" 
            max = "100" value = "60">
      </form>
      
   </body>
</html>

輸出

讓我們完成以下步驟來了解上述程式碼如何執行 −

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

  • 以 https:///slider_mini.html 開啟此 HTML 檔案,隨後將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.