垂直組,迷你子選單



說明

在 fieldset 中包含 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>
      <h2>Selectmenu vertical group mini Example</h2>
      <form>
         <fieldset data-role = "controlgroup" data-mini = "true">
            <legend>Vertical group menu</legend>

            <label for = "select">Select</label>
            <select data-iconpos = "left" id = "select">
               <option value = "#">Maharastra</option>
               <option value = "#">Mumbai</option>
               <option value = "#">Pune</option>
            </select>

            <label for = "select">Select</label>
            <select data-iconpos = "left" id = "select">
               <option value = "#">Karnataka</option>
               <option value = "#">Bangalore</option>
               <option value = "#">Belgaum</option>
            </select>

            <label for = "select">Select</label>
            <select data-iconpos = "left" id = "select">
               <option value = "#">Tamil Nadu</option>
               <option value = "#">Chennai</option>
               <option value = "#">Ooty</option>
            </select>
            
         </fieldset>
      </form>
   </body>
</html>

輸出

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

  • 將上述 HTML 程式碼另存為伺服器根資料夾中的selectmenu_vertical_group_mini.html 檔案。

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.