jQuery Mobile - 列表檢視分隔線



說明

data-role = "list-divider" 屬性新增到任何列表項以將其分成一組列表項。data-divider-theme 屬性可用於將主題包含到列表項中。

示例

以下示例演示了在 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>List Dividers Example</h2>
      <ul data-role = "listview" data-inset = "true" data-divider-theme = "b">
         <li data-role = "list-divider">Karnataka</li>
         <li><a href = "#">Bangalore</a></li>
         <li><a href = "#">Mangalore</a></li>
         <li><a href = "#">Hubli</a></li>
         <li data-role = "list-divider">Maharastra</li>
         <li><a href = "#">Pune</a></li>
         <li><a href = "#">Mumbai</a></li>
      </ul>
   </body>
</html>

輸出

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

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.