jQuery Mobile - 複選框迷你尺寸



說明

在元素中包含屬性 data-mini = "true" 來建立迷你版本。這在工具欄和緊湊空間的情況下很有用,能得到更緊湊的版本。

示例

以下示例演示了 jQuery Mobile 中迷你尺寸複選框的用法。

<!DOCTYPE html>
<html>
   <head>
      <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>
      <div data-role = "page">
         <form>
            <input type = "checkbox" id = "mini-1" data-mini = "true" />
            <label for = "mini-1">Checkbox mini 1</label>

            <input type = "checkbox" id = "mini-2" data-mini = "true" />
            <label for = "mini-2">Checkbox mini 2</label>
         </form>
      </div>
   </body>
</html>

輸出

讓我們執行以下步驟,來看看上面的程式碼如何工作 -

  • 將上面的 html 程式碼另存為 mini_size.html 檔案,儲存在你的伺服器根資料夾中。

  • 開啟這個 HTML 檔案為 https:///mini_size.html,將會顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.